Strategic advice from KataHex

From HexWiki
Jump to: navigation, search

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

Capture patterns

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

Most of the time, you should play at Red 1 in the position below when given the opportunity, because you capture the hexes marked (*). Many players think it's too naive/obvious to be good, or that their opponent must be setting up a trap, but it's much more common that a player fails to play the move when it's in fact strong. (This pattern is common enough that it probably deserves a name.)

1

There is one main exception: this is less strong if the move you're bridging to is otherwise bad for global reasons, like it's on the second or third row of your own edge, or it's on the 5th row of your edge but you already have a bunch of other stones near that edge.

  • 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.

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.

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.)

Common patterns that are locally efficient for Red — intuitively, it's strong to "cut through" your opponent's potential connection. Example A1 holds more strongly; 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. Example A2 is weaker; there are more cases where Red 1 isn't actually the best move. In example A1, 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.

A1:
1
A2:
1

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.

Often, locally inefficient patterns arise when one player induces the other to play a bunch of stones adjacent to each other. Example B1 below is very common. The "triangle" often appears in ladder bottleneck positions, where it's not as bad because Red often has compensation in the form of a threatening ladder.

B1:
1
B2:
321

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:.

C1:
1
C2:
1
C3:
1

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.

D1:
1

TODO: elaborate some more, with more complicated examples and situations from real games. It's possible to learn these intuitions by spending a lot of time with KataHex. Think about the most useful way to express these intuitions in article format.

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

4-4 obtuse corner: minimax or defend second row ladder?

A common sequence for Red is to minimax at 5, when Blue has a ladder escape for the second row ladder starting at 4:

15324

Many players play 5 above even when Blue doesn't have a ladder escape for 4. Sometimes this is fine, but KataHex often prefers to defend the second-row ladder instead:

198327654

When Blue can't escape 4, it may be a good idea for Red to defer the question of which move 5 to play until later.


TODO: advice on specific openings (a3 and c2) and board sizes (there is a lot of content here, in progress)