Difference between revisions of "Strategic advice from KataHex"

From HexWiki
Jump to: navigation, search
(clarify discussion of small patterns)
Line 150: Line 150:
 
/>
 
/>
  
In each of these patterns, we will discuss the strength of Red's move 1 ``in a vacuum``, meaning in the absence of nearby stones, like near the middle of an empty board on 19×19 or even larger boards. It is most useful to analyze each pattern without the influence of nearby edges (which can be thought of as virtual rows of stones) or stones.
+
In each of these patterns, we will discuss the strength of Red's move 1 ``in a vacuum``, meaning in the absence of nearby stones, like near the middle of an empty board on 19×19 or even larger boards. It is most useful to analyze each pattern without the influence of nearby stones or edges (which can be thought of as virtual rows of stones).
 
* Pattern 1: It's typically an inaccuracy for Blue to play adjacent to a red stone in a vacuum. Red's best response is usually playing adjacent to both stones, as in Red 1.
 
* Pattern 1: It's typically an inaccuracy for Blue to play adjacent to a red stone in a vacuum. Red's best response is usually playing adjacent to both stones, as in Red 1.
 
* Pattern 2: Blue plays a bridge away from Red's stone. This is often a good move, and Red 1 a bridge away from both stones is also good.
 
* Pattern 2: Blue plays a bridge away from Red's stone. This is often a good move, and Red 1 a bridge away from both stones is also good.
Line 227: Line 227:
 
/>
 
/>
  
Here are common efficient patterns for Red relative to an edge. C1 is strong because Blue cannot fit a ziggurat between the two red stones. C2 is common when Red opens with a first column opening. Example C3 requires elaboration: normally Red 1 is a weak move because it's too close to Red's own edge. However, when Red must play on his first 3 rows (because of very limited space), Red 1 or its mirror image at (*) is usually the best, because it prevents Blue from playing there and forming a pattern equivalent to example C2 herself. Example C3 also occurs in theoretical contexts, like [[Template Va#If Blue moves at y:]].
+
Here are common efficient patterns for Red relative to an edge. P1 is strong because Blue cannot fit a ziggurat between the two red stones. P2 is common when Red opens with a first column opening. P3 requires elaboration: normally Red 1 is a weak move because it's too close to Red's own edge. However, when Red must play on his first 3 rows (because of very limited space), Red 1 or its mirror image at (*) is usually the best, because it prevents Blue from playing there and forming the equivalent of P2 herself. P3 also occurs in theoretical contexts, like [[Template Va#If Blue moves at y:]].
C1: <hexboard size="6x2"
+
P1: <hexboard size="6x2"
 
   float="inline"
 
   float="inline"
 
   edges="left"
 
   edges="left"
Line 234: Line 234:
 
   contents="R b5 1:b2"
 
   contents="R b5 1:b2"
 
/>
 
/>
C2: <hexboard size="3x2"
+
P2: <hexboard size="3x2"
 
   float="inline"
 
   float="inline"
 
   edges="left"
 
   edges="left"
Line 240: Line 240:
 
   contents="R a2 1:b3"
 
   contents="R a2 1:b3"
 
/>
 
/>
C3: <hexboard size="2x6"
+
P3: <hexboard size="2x6"
 
   float="inline"
 
   float="inline"
 
   edges="bottom"
 
   edges="bottom"
Line 247: Line 247:
 
/>
 
/>
  
In example D1, Red 1 is a tempting (because of [[edge template III1b]]), common, but inefficient move, because Blue's response at one of (*) is usually strong. If Red must play near his own edge, he should instead play as in example C3.
+
In the following example, Red 1 is a tempting (because of [[edge template III1b]]), common, but inefficient move, because Blue's response at one of (*) is usually strong. If Red must play near his own edge, he should instead play as in P3 above.
D1: <hexboard size="3x5"
+
<hexboard size="3x5"
 
   float="inline"
 
   float="inline"
 
   edges="bottom"
 
   edges="bottom"

Revision as of 00:19, 9 June 2024

Introduction

Several hex bots have popped up in the last few years. Many are neural nets and adaptations of Go bots like AlphaGo Zero. The most recent (and likely strongest) as of 2023 is KataHex, which is based on the open-source KataGo. These bots have influenced human play in many aspects already; one of the most notable is the bots' preference for the 4-4 obtuse corner over the 5-5. Many old strategy guides have become at least partially (if not mostly) outdated.

This article attempts to bring some strategy advice "up-to-date". There's a lot of random insights; most are a direct result of playing around with KataHex evaluations for hundreds of hours, including analyzing the games of strong players for common mistakes. Since this is strategic advice and not tactics, the advice won't apply 100% of the time, and many players may disagree with some parts.

Care has been taken to only draw conclusions when there are multiple examples of KataHex preferring something. However, the main goal of this article is to give actionable advice to make players stronger, and there isn't rigorous proof for basically any of these statements.

For brevity, nearly every statement should have hedging language like "usually" or "rarely" instead of "always" or "never," but this makes the article really verbose, so I only do it when it seems useful.

General

Common mistake: playing near your own edge

Playing near your own edge with no nearby stones is a bad idea in the opening and even middlegame. This is one of the most common mistakes among human players. You need a strong (often tactical) reason to do otherwise.

  • When is playing near your own edge a good idea? There are a few cases, like when you're playing adjacent to existing stones, responding to a joseki, or pushing a ladder as the attacker, but all of these involve stones in the vicinity.
  • This holds most strongly for 13×13 to 19×19, but applies more often than not to 11×11 too.
  • Playing near your own edge in the opening or early middlegame should be a "last resort". I would recommend never doing so in the first 30-40 moves in 19×19 unless you have a very good reason.

Common mistake: bad minimaxing

Many intermediate and strong players are too eager to minimax. They play bad minimaxing moves (that KataHex thinks are inferior to directly connecting) more often than they fail to minimax. The issue is that minimaxing isn't always free; your opponent can often intrude for useful territory, and sometimes the territory your opponent gains is more useful than what you gain by minimaxing. It's a difficult skill to judge which player gains more from a minimax, but there are common patterns.

Common mistake: bad bridge peep

A common scenario is the bridge peep. Blue should play at (*) as long as she thinks it's forcing enough for Red to defend his bridge.

However, even if Blue hasn't played (*) yet, Red should usually mentally place a blue stone there. Especially on larger boards, Blue will be able to play at (*) sometime in the future. This is important: even if (*) is empty, I like to think of this pattern as implying a blue stone at (*) (in the absence of tactics that somehow prevent Blue from playing there). Another way (useful for me, but the analogy might be nonsense to others) to think about it is that Blue's stone at A is well-placed enough relative to Red's bridge that she has some "potential energy" at (*).

A

However, 80% of the time, if there's no blue stone at A, Blue should not intrude on either side of the bridge. Intruding is usually a mistake because it settles the question for Red. If Red knows he will have a stone at A or B because Blue already intruded in the other spot, Red can better plan his future moves because of that! There are exceptions; if Blue is confident that only one of the intrusions will ever be useful for her, then intruding is often strong.

AB

Ladders

  • Don't worry about switchbacks, climbing, or ladder creation templates on 15x15 or larger. They can be theoretically interesting and make for good puzzles, but games are rarely close enough for these to matter. Controversially, I personally don't think about them on any board size.
  • Q: When should the defender of a ladder yield? A: Usually, don't yield unless your opponent can cut through two of your stones, one above and one below the ladder. In that case, consider yielding.
    • Here is an example. If Blue instead plays 8. d11, Red 9. e10 cuts through e9 and d11.

Other

  • Be aggressive; always be ready to capitalize on an opponent's mistake. Here are a few illustrative examples of this and some of the above concepts:
    • In this game, 6. c9 was a mistake (and an example of incorrect minimaxing); 7. a10 is the standard reply. White should have played 8. b8; j4 was a mistake. Black's 9. b8 is the "capitalizing" move; KataHex already says 99% win rate for Black. In this case, there were several good options on move 9. These alternatives are threatening enough that Black didn't have to play b8, but this won't always be true, like in the next example.
    • In this game, 11. e6 was a mistake; the best move was to respond to the obtuse corner joseki with i4. Because Black did not play i4, White was able to play 12. i4, with a 70% win rate (whereas the second-best move has only a 61% win rate). If White plays elsewhere, that gives Black a chance to correct the mistake by playing i4, so i4 needs to be played immediately. Another example is in the following move; 13. g5 is a mistake because 14. h6 captures the two hexes in White's bridge. This move also needs to be played immediately because otherwise Black can then play h6; the bot says 93% win rate after 14. h6, and only 65% if White plays the reasonable-looking i10 instead. I find that even strong humans are often hesitant to play the aggressive bridge moves in situations like moves 12 and 14 here, probably because it looks like it's focusing too much on a single area of the board.
    • Here is yet another example (interestingly, White resigned in a winning position according to the bot, though the final position is highly tactical). KataHex actually thinks Black has only an 18% win rate after 26. m6. However, 27. d11 is a "minimaxing with adjacent stones" mistake, bringing Black's win rate down to 0.5%. After several inaccuracies from White, Black regained some lost ground in moves 28-32 and would have had a 30% win rate by connecting simply with 33. d13. On the other hand, KataHex thinks 33. i9 is an inaccurate attempt to minimax; the win rate is down to 9% after White replies with 34. d13.
  • Don't play a move that makes your opponent's existing stones unnecessarily well-placed relative to your new stone. This is covered briefly in a couple places in the 19×19 opening guide. Here are a couple more examples.
    • In this game (HexWorld link), what should Black play on move 27? White is threatening to connect 26 back to the 16–24 group if Black isn't careful. Black's obvious options are to play at c8 and c9. Which option is better?
    • A tempting answer is c8 because it appears to connect more closely to the top. However, note that White's stone on move 14 functions exactly like an opening a3 stone. For example, it can escape 2nd but not 3rd row ladders. If Black plays c8, White can play the A3 escape trick, as shown in this continuation. This sequence allows White to "make the most" of stone 14, and Black shouldn't allow it. Better for Black is 27. c9, which doesn't allow White to carry out a 3rd-to-5th row switchback. Indeed, KataHex evaluates c9 as 96% to win for Black and c8 as only 31%.
    • Consider this position (which is based on this game). Where should White play in the lower-right acute corner? Black had just played at the "3-7" point from White's perspective; as mentioned in the 19×19 opening guide, a strong response to 3-7 is 4-4 (at j10) instead of the usual 5-4 (at j9). A player who is short on time can play j10 without thinking too hard. As it turns out, KataHex thinks j10 is the best move, evaluating it as 85% for White, whereas j9 is only 38% because of Black's reply at j10.
  • Sometimes, you know you have a completely winning position after your opponent blunders very early in the game. Your goal is to preserve that win until the end of the game. Don't overextend yourself and try to win too "quickly", possibly making possibly suboptimal moves in the process. Even when KataHex plays itself with a significant handicap (like playing without swap), a significant fraction of the board seems necessary to carry out the win, assuming strong defense. I prefer taking my time to "fill the board" by focusing on playing moves at least as good as my opponent's, instead of worrying about connecting in as few moves as possible.

Local patterns

An especially effective way to improve at Hex is to learn and gain intuition about lots of small local patterns. These patterns are small enough that they occur basically everywhere when you play Hex. Knowing the patterns can help you avoid blunders (for example, avoiding moves that allow your opponent an adjacent or bridge cut through your stones) and make good moves when it's otherwise unclear what to play.

Cuts

1
1
1
1
1

Suggested names for brevity (in order): adjacent cut, near cut, short bridge cut (or just bridge cut), long bridge cut, skew cut.

Some of these cuts are stronger than others. The adjacent cut and the short bridge cut are perhaps the strongest — usually cutting through is the best move (unless doing so involves playing a stone that's too close to your own edge, or some other concession), so you can play Red 1 without thinking too hard. The near cut is weaker; there are more cases where Red 1 isn't actually the best move.

  • Why is the adjacent cut above so strong for Red? Blue has to play a lot of moves to reconnect the two blue stones. In practice, Blue will try for a connection elsewhere, and probabilistically, the two blue stones are unlikely to be very useful.
  • The (short) bridge cut is strong for Red because he captures the two hexes marked (*). If Blue allows a bridge cut, often the damage has already been done even if Red doesn't actually cut through immediately on the next turn. (This isn't always true; some tactical situations require Red to cut through immediately instead of playing elsewhere.)
    • However, there are situations where Blue should allow a bridge cut. If Red's cutting move comes with concessions, like the move is on his second or third row (and especially if Red already has a stone near his own edge, so cutting through would be overplaying that edge), the pattern is much less favorable to Red.
  • The skew cut is situation-dependent. When there are no nearby stones, Red 1 is usually the strongest local reply. Many humans are tempted to play one of (*) because it looks like it cuts through the two stones the most effectively. This is often a good move, so don't be afraid to play it, but it's worth checking if Red 1 is better (in the opening, it usually is stronger).

Small patterns

1
1
1
1
1

In each of these patterns, we will discuss the strength of Red's move 1 ``in a vacuum``, meaning in the absence of nearby stones, like near the middle of an empty board on 19×19 or even larger boards. It is most useful to analyze each pattern without the influence of nearby stones or edges (which can be thought of as virtual rows of stones).

  • Pattern 1: It's typically an inaccuracy for Blue to play adjacent to a red stone in a vacuum. Red's best response is usually playing adjacent to both stones, as in Red 1.
  • Pattern 2: Blue plays a bridge away from Red's stone. This is often a good move, and Red 1 a bridge away from both stones is also good.
  • Pattern 3: Red 1 is a classic block. This is often fine for Red, and Blue doesn't have an obvious best local response. Blue could tenuki here.
  • Pattern 4: Red 1 is usually fine. If Blue plays elsewhere, Red should usually avoid playing at (-), because Blue's response at (*) is strong.
  • Pattern 5: Blue plays two bridge moves away. Again, if Blue plays elsewhere, Red should avoid playing at (-).

Capture patterns

Know the most common captured cell patterns. It really reduces the number of moves you have to consider.

The bridge cut is one of the most important capture patterns.

  • A typical example can be found in this game. After 10. g11, Black would have the easiest time with 11. h9, with 92% win rate, instead of the played k8 with 60% win rate. After k8 was played, one of White's best moves would've been h9 to prevent Black from playing the same. KataHex does think Black has other reasonable options on move 11, but they mostly appear to just delay h9.

Here is another common capture pattern. The other patterns on captured cell are useless because they have too many Red stones adjacent to each other, which is too inefficient to occur in normal play.

This one-sided capture pattern is very common. I like to mentally replace A with a blue stone and (*) with a red stone (even though Blue won't always achieve this), because Blue should never play at (*). Edge template IV3a is useful to know here.

A

The trapezoid and crescent also one-sided-capture the hexes at (*). Anecdotally, this fact is more useful on smaller boards like 11×11, but it's less common overall than the previous capture patterns.

How to think about the opening and middlegame

Some of these points sound like hyperbole, but they are a fairly accurate representation of how I think about Hex, especially on larger boards. There are exceptions, but exceptions are rarer than one might think.

  • In the first half of the game, focus all of your attention into playing "efficient" moves. These are moves that work well with existing stones and board edges. Excellent intuition of efficient patterns is enough to get strong middlegame positions against even top players (as of mid-2023).
  • Don't worry about tactics until the late middlegame. It's a waste of time to analyze sequences >10 moves deep. In the opening, the best move you can find with only intuition is no worse than the best move you can find with calculation.
    • Why? Compared to bots, humans are very bad at calculation. Your intuition (which you learn directly from KataHex) is more useful than hypothetical hours or days of error-prone human analysis.
  • Use your knowledge of efficient patterns to plan ahead. This is where you want to do shallow analysis, typically 1-5 moves deep. A good move does as much as possible:
    • allows you to play efficient moves later
    • prevents your opponent from playing an efficient move outright
    • allows your opponent an efficient move, but only with concessions (say, a locally efficient but globally inefficient move, or a move that's efficient with relative to one stone but inefficient relative to another)

These points require a lot of elaboration. What do I mean by "efficient"? (Not to be confused with efficiency.) There are two broad notions, global and local efficiency.

  • Globally efficient stone: Broadly, any move that isn't too close to your own edge. Moves that are strong in the absence of nearby stones (like on an empty board). Corner moves are very efficient. On 19×19, moves near your opponent's 5th row are very efficient.
  • Locally efficient stone: In the presence of nearby stones, some configurations are broadly "good" or "bad" for one player. They aren't always good or bad because of tactics, but because humans can't calculate everything, it's extremely useful to have decent heuristics that work most of the time.

(People say Hex is a game of perfect information with no randomness. I disagree. If you're an intermediate player, and you have Blue in this game in 100 parallel universes, you might be unsure what the best move is. You might play j10 (an "obvious" joseki) in 50 of those universes, h5 (another "obvious" move with Blue 4) in 30, g7 (the center is tempting, but it loses on the spot to e8) in 15, and if you're lucky, the best move e11 in 5 universes. On the other hand, if you're a strong player with good intuition, you realize Red's main threat is e8, a very efficient move relative to Blue 2 and Red 5. You might play e11 in 60 of the universes, f8 (an acceptable move that blocks e8) in 30, and j10 only 10% of the time.)

As explained in the "Cuts" section, it's strong to "cut through" your opponent's potential connection, especially in the adjacent cut and bridge cut.

The small patterns in the "Capture patterns" section above are also locally efficient for the capturing player. You should generally play them when given the opportunity, and prevent your opponent from doing the same.

Just as offense and defense are equivalent in Hex, so are playing locally efficient moves and inducing your opponent to play locally inefficient moves. Sometimes, locally inefficient patterns arise when one player induces the other to play a bunch of stones close together. Here is an example (which occasionally happens in actual games), where Red is connected but took a lot of stones to connect.

321

Here are common efficient patterns for Red relative to an edge. P1 is strong because Blue cannot fit a ziggurat between the two red stones. P2 is common when Red opens with a first column opening. P3 requires elaboration: normally Red 1 is a weak move because it's too close to Red's own edge. However, when Red must play on his first 3 rows (because of very limited space), Red 1 or its mirror image at (*) is usually the best, because it prevents Blue from playing there and forming the equivalent of P2 herself. P3 also occurs in theoretical contexts, like Template Va#If Blue moves at y:.

P1:
1
P2:
1
P3:
1

In the following example, Red 1 is a tempting (because of edge template III1b), common, but inefficient move, because Blue's response at one of (*) is usually strong. If Red must play near his own edge, he should instead play as in P3 above.

1

Making inferences: An extended example

Use the patterns and intuitions that you know, to reason and make inferences in unfamiliar positions. You might not always find the best move, but you can often prune bad moves. Here is an extended example, involving several closely related patterns that are useful to know in isolation.

  1. Pattern: If you play the 4-4 3-3 obtuse corner joseki, it is important to know that Blue 6 here is weak.
    • This is because Red 7 undermines Blue 6 and also reduces Blue 2/4 from a 3rd row ladder escape to a 2nd row escape. Also, Blue's potential intrusion at c16 doesn't gain her anything.
    • Instead, here is a good local response for Blue. This gives Blue a 5th row ladder escape while blocking Red 1.
    • On the other hand, if Blue only has a 2nd row escape and doesn't have the "potential energy" to get a 3rd row escape, you might guess that Blue 6 above becomes a good local move, because Red 7 loses one of its main strengths. Such a guess would be correct: in this position, Blue 10 is a strong move. On the other hand, Blue 10 at d15 would be weak here, as it's quite wasteful, only converting a 2nd row escape into a 3rd row escape.
  2. Pattern: If Red tenukis on move 3, then Blue 4 is locally strong in this position. In particular, Blue 4 is much stronger than bridging directly towards Blue's own edge with g13, because the former is a strong blocking move that reduces the effectiveness of Red 1. This strength is in spite of Red's intrusion on move 5. (I first saw this move in this bot game from this thread on LittleGolem.)
    • This pattern is actually applicable in many situations and is an example of pattern P2 (top-middle) above. If Red started with the 5-5 obtuse corner, then the equivalent Blue 4 is also strong.
    • Another simple example is Red 5 in this position.
  3. Inference: Let us consider this position again. Suppose Blue tenukis on move 6. What is a good local response for Red on move 7? There is more than one right answer, but you just need to find one move that isn't a blunder.
    • Hint: Use the two patterns above to come up with an answer.
    • Hint: Consider that Blue has a 3rd row ladder escape, so Blue d15 is locally strong but Blue e14 is weak. This is the case for future blue stones in this local region, even though Blue already played elsewhere on move 6. Therefore, Red should perhaps try to play a move that makes Blue d15 less attractive, even if it comes at the concession of making Blue e14 more attractive (since the latter is a priori a weak move, such a concession gives up less than it otherwise might).
    • Answer: Red 7 here is a good local move.
      • Why? Ignoring stones 2-5, the presence of Red 1 and 7 makes Blue e14 more attractive. Red's 4-4 stone, much like the obtuse corner opening, tends to shift Blue's efficient stone locations up one row. With that in mind, Red's move 7 is a bit like Red e14 on an empty board, where Blue e15 is the best response. However, stones 2-5 make Blue e14 a bad move, despite Red 7 making it slightly less bad (this is the concession-but-not-really-a-concession that Red intended).
      • Let's now consider Blue d15. Normally a decent local move after stones 1-5, it becomes quite weak after Red 7, because of this sequence. This is a typical example of the second pattern in this extended example. (Actually, if Blue had two moves in a row in this region, Blue 8 wouldn't be so bad because she could follow up with f14, where Red wants to play move 9. This is a tactical situation where it's bad for Red to tenuki.)
      • If we wanted to be complete, Blue actually has another option for move 8, f14 first which threatens d15: here. This is an example of the "skew cut" from above. Red should respond with d15 himself, or else Blue can play d15. This is probably Blue's best local response.
      • Every move makes a concession, but some concessions are more effective than others. As alluded to in the hint, Red 7 weakens a strong Blue reply (d15) while strengthening a weak Blue reply (e14). Red's goal is to minimize the strength of Blue's best response (rather than the strength of Blue's average response), and Red 7 at e13 accomplishes that beautifully.

Part of getting stronger at Hex (as with other games) is being able to compress knowledge and patterns effectively. If you understand this extended example, you can infer the best move in many similar but novel situations, without memorizing each one individually. If you forget which move is exactly the best, you can recover the right move with high probability by just reasoning about related patterns that you do know are strong or weak. The "A3 escape trick" example earlier in this article is another instance of this concept.

On larger boards and particularly near the opening or middlegame, when you have a lot of time to think about a position, it may be worth spending a good chunk of it making inferences and scoping out moves that are either good or to be avoided by each side, rather than spending most of your time calculating tons of lines and variations.

  • In fact, once you've scoped out that "moves A and B are good for Red, while moves X and Y are bad for Red" and similarly for Blue, that makes the process of analyzing and pruning lines much more efficient.

Joseki

  • The 4-3 corner move is almost always a mistake compared to the 5-4, even on 11×11. If your opponent plays 4-3, 90% of the time the best reply is 3-3. If 4-3 is played, here are some common sequences:
132
13524ab

In the second joseki, Blue should play either (a) or (b), or she can defer the question until later. On larger boards with no nearby stones, (b) is often better.

  • If your opponent plays the 5-4 joseki, a reasonable choice is to always play the 4-4 "high intrusion." KataHex prefers the 4-4 response by far, especially on 13×13 and larger. It's easily the "safest" choice, and many strong players have recently shown a clear preference for 4-4.
  • The following joseki seemed common among top players a couple years ago. However, Blue 4 is questionable, and Red 5 is also often worse than playing at one of (*). Even though Red has to defend a 3rd row ladder after playing at either (*), this is frequently preferable to letting Blue connect outright in the acute corner.
51324

Specific tactics

Threatening a bridge cut

One of my favorite tactics is threatening a bridge cut, where the opponent needs to play too close to their own edge to defend:

21

Red 1 is a strong move, because it forces Blue to respond at 2 (or else Red will play the bridge cut there), but Blue 2 is normally overplaying on the left side when combined with Blue's stone at (*). Be on the lookout for this when your opponent plays the 4-4 and 7-7 obtuse corner, or 5-5 and 8-8.

This tactic can work well in other configurations, like this and this. However, be careful when using this tactic! When Blue isn't actually making a concession by bridging her two stones, like when the pattern occurs further from her own edge, it can be a blunder for Red to threaten a bridge cut. Here is an example where Red 5 is a blunder in the absence of nearby stones.

Here is an example from a real game. Black's best move is 13. h5 (in the actual game, Black doesn't play this until move 19 but is still arguably rewarded for doing so). One might think that h5 is too strong near the top edge because of c2 and b5, but this is not the case because the white stone on c5 partially neutralizes b5.