Difference between revisions of "User:Hexanna"

From HexWiki
Jump to: navigation, search
(reorganize)
(recursive swap)
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
19×19 is the most popular of the "large" board sizes. This board size offers a lot of room for strategic freedom (unlike 11×11 or 13×13), but tactics and local play remain highly important.
+
[[Openings on 19 x 19]]
  
An average well-played game lasts about 72-90 moves before one side resigns, or 20-25% of the board, though it varies considerably from game to game.
+
[[Strategic advice from KataHex]]
  
The advice in this guide is heavily influenced by hzy's KataHex bot, the strongest known (and easily superhuman) bot as of March 2023.
+
I started learning Hex mid-July of 2021, about 2 weeks before I created my LittleGolem account.
  
==Differences from smaller boards==
+
==Insights and tidbits from KataHex (hzy's bot)==
  
* While [[corner move|corner moves]] are still good moves, playing near the middle of your opponent's 5th row is often just as good. This starts to become true for boards 18×18 and larger.
+
* katahex_model_20220618.bin.gz (I'll call this the "strong" net) appears significantly stronger than the "default" net.
 
+
* Swap map for 19×19 generated with the strong net, with around 15k visits for most moves. For the red hexes, the number corresponds to Blue's Elo advantage if she swaps Red's move; for the blue hexes, the number corresponds to Blue's Elo advantage if she does not swap Red's move. Smaller numbers correspond to fairer openings. Includes all fair openings as well as a few selected unfair openings, including the strongest move without swap (e10). I used more visits for the fairest moves: 1000k for e3 (49.5% win rate), 500k for n3 (49.2%), 100k for a15 (52.5%).
*  Ladders and ladder escapes are less important. Human games often have long ladders across a side of the board, but it's usually a mistake for the defending side to keep pushing the ladder. Often, it's best for the defender to jump, allowing their opponent to connect in exchange for territory. Here is a [https://hexworld.org/board/#19n,c2d16p15o5r4q2q3r2p3p2o3m3o2 common example].
+
** Key takeaways: The swap map at [[Swap rule#Size 19]] uses [https://pic4.zhimg.com/v2-7287c3a2a4e948da89c3ccad38cea82f_r.jpg data] that is almost certainly from the "weak" net. Compared to the weak net, the strong net notably thinks a19, n3—p3, and k4—l4 are stronger. I personally trust the strong net's evaluations more; I think it's dubious that the weak net thought l4 was a very fair opening. The nets disagree on whether e3 is winning or losing, though it's so close to 50% that the difference isn't meaningful.
 
+
* There is a lot more room to ignore your opponent's threats and [[tenuki|play elsewhere]] in the early opening. Moves are less forcing, and there's a much larger variety of different strategies you can try.
+
 
+
* On smaller boards, the game becomes quite tactical after the opening, and playing well often means playing stones that "work well" with existing stones near the corner. On 19×19, there is room to start a local fight near the middle of the board, relatively far away from existing stones.
+
 
+
==Common human mistakes==
+
 
+
* Playing too close to your own edge is by far the most common mistake in the opening. There are exceptions where it can be a good idea, like when you're playing a corner move or joseki, or your opponent has intruded heavily into one of your edges, or you're responding to a local tactical situation. However, if your opponent hasn't played near one of your edges, it's almost always a bad idea to play a move closer to that edge than one of your opponent's edges.
+
 
+
==General principles==
+
 
+
* Corner and edge moves: In the absence of other stones nearby, Red would do well to play in one of the following spots:
+
  
 
<hexboard size="19x19"
 
<hexboard size="19x19"
 
   coords="show"
 
   coords="show"
   contents="R d5 e6 *:f7 g8 f9 *:e10 *:e11 *:d16 p15 o14 *:n13 m12 n11 *:o10 *:o9 *:p4"
+
   contents="S red:all blue:(a1--r1 a2--q2 a3 e3--n3 s3)
 +
              blue:(a17 f17--o17 s17 c18--s18 b19--s19)
 +
            E 65:(d3 p17)
 +
              3:(e3 o17)
 +
              73:(f3 n17)
 +
              76:(g3 m17)
 +
              73:(h3 l17)
 +
              84:(i3 k17)
 +
              90:(j3 j17)
 +
              103:(k3 i17)
 +
              104:(l3 h17)
 +
              49:(m3 g17)
 +
              6:(n3 f17)
 +
              47:(o3 e17)
 +
              59:(p3 d17)
 +
              72:(i4 k16)
 +
              67:(j4 j16)
 +
              81:(k4 i16)
 +
              94:(l4 h16)
 +
              69:(q2 c18)
 +
              96:(b17 r3)
 +
              77:(a2 s18)
 +
              67:(b2 r18)
 +
              56:(c2 q18)
 +
              100:(a3 s17)
 +
              83:(a4 s16)
 +
              73:(b4 r16)
 +
              136:(a5 s15)
 +
              93:(a6 s14)
 +
              95:(a7 s13)
 +
              131:(a8 s12)
 +
              99:(a9 s11)
 +
              41:(a10 s10)
 +
              81:(a11 s9)
 +
              81:(a12 s8)
 +
              78:(a13 s7)
 +
              56:(a14 s6)
 +
              17:(a15 s5)
 +
              57:(a16 s4)
 +
              110:(a17 s3)
 +
              174:(a18 s2)
 +
              56:(a19 s1)
 +
              382:(e10 o10)"
 
   />
 
   />
  
This is far from an exhaustive list; many other moves near the middle of Blue's 4th to 6th rows are often just as good. Of course, the presence of other stones even moderately nearby can influence things. KataHex prefers the spots marked (*) especially often.
+
==Random unsolved questions==
  
* If Blue plays too closely to her edge, Red usually has some good local responses. In particular, if Blue plays near the middle of her 4th row, Red can choose one of the following blocks:
+
Most of these are very difficult to answer, and I would be happy if even a few were answered in the next few years:
<hexboard size="7x7"
+
  coords="hide"
+
  edges="left"
+
  contents="B d4 E A:f3 B:e4 C:e5"
+
  />
+
KataHex prefers A the most often on a relatively empty board.
+
  
* If Blue plays near the middle of her 5th row:
+
* Is the obtuse corner always winning on larger board sizes? What about the b4 opening? Let P(n) be the statement that "the obtuse corner is a winning opening in n&times;n Hex without swap." There are a few possible cases; an interesting exercise is to come up with subjective probabilities of each case being true.
<hexboard size="7x8"
+
** A. P(n) is always true. If so, can we prove this?
  coords="hide"
+
** B. P(n) is true for infinitely many n, with finitely many counterexamples. If so, what's the smallest counterexample?
  edges="left"
+
** C. P(n) is true for infinitely many n, with infinitely many counterexamples. If so, does P(n) hold "almost always," "almost never," or somewhere in between?
  contents="B e4 E A:g3 B:f4 C:f5 D:d6 E:c5 F:d3 *:f2"
+
** D. P(n) is true for finitely many n. If so, what's the largest such n?
  />
+
* Kriegspiel Hex (Dark Hex), a variant with incomplete information
KataHex usually prefers A or E, though B/C/D/F are also common. The move marked (*) is usually less good, because Blue can respond at A.
+
** Under optimal mixed strategies, what is Red's win probability on 4&times;4?
 +
** For larger boards (say, 19&times;19), is Red's win probability close to 50%?
 +
*** If so, a swap rule might not be needed for Kriegspiel Hex, which would be neat.
 +
*** If not, imagine a variant where Red's first move is publicly announced to both players, and Blue has the option to swap it. Which initial moves are the fairest now?
  
* If Blue plays near the middle of her 6th row:
 
<hexboard size="7x9"
 
  coords="hide"
 
  edges="left"
 
  contents="B f4 E A:h3 B:e6 C:d5 D:e3 *:(g2 g5) +:g4"
 
  />
 
Here, all of A/B/C/D are often good choices. The moves marked (*) are usually worse because Blue can respond at A. The move marked (+) is also worse, and Blue usually does well to tenuki.
 
  
* If Blue plays close to the center, Red would do well to block at a distance, rather than using an adjacent or near block.
+
replies by [[User:Demer|Demer]]:
  
* A well-played game between equally matched players should "use" almost the whole board. In particular, large templates like [[edge template VI1a]] rarely matter on 19&times;19. Many players are tempted to play a stone in the middle of their 6th row, because such a stone is connected. However, the opponent has good responses intruding into the template (see above).
+
* https://zhuanlan.zhihu.com/p/476464087 has percentages, although it doesn't translate these into a guessed swap map and I don't know anything about the bot they came from.
 +
**​ It suggests that [on 13x13, g3 is the most balanced opening] and [on 14x14, g3 should not be swapped].
 +
** On 27x27 without swap, it likes the 4-4 obtuse corner opening slightly more than anything else nearby.
 +
* As far as I'm aware, even 3&times;4 Dark Hex has not been solved. ​ (https://content.iospress.com/articles/icga-journal/icg180057 apparently gives "some preliminary results" for that size.)
  
* Suppose Red has played the 5-4 opening. It turns out that a [https://hexworld.org/board/#19nc1,d5g3:pd4 decent response by Blue] is playing at 3-7 (from Red's perspective), partially due to the threat of Blue 4-4 as a followup. This would imply that, had Blue ''first'' played at 3-7 before Red played in the corner, Red should not respond with 5-4, because that would make Blue's 3-7 (which was placed first) unnecessarily effective. Red should instead play a move that works well against Blue's stone. It turns out that the [https://hexworld.org/board/#19nc1,:pg3d4 4-4 corner] is such a move. This is an important concept &mdash; you don't want to play a move close to your opponent's, if that would make your opponent's stone efficiently placed relative to yours.
+
hexanna:
  
* Here's another [https://hexworld.org/board/#19nc1,e4d4d5 example]. Red accidentally played the 4-5 corner move instead of 5-4. Blue should not play 4-4, because then Red could play 5-4, and he would be in the same position that he would've been, had he played the first move correctly (via the Red 5-4, Blue 4-4, Red 4-5 joseki). Blue essentially let Red out of his mistake. A better move for Blue here is simply to tenuki.
+
* Thank you, this is amazing! From the Google Translate, the bot is an adaptation of KataGo trained on 13&times;13 and smaller, using transfer learning to train larger nets on top of the 13&times;13 net for a short period of time. I may edit the [[swap rule]] article later with some insights.
 +
** The results for up to 15&times;15 look very reliable to me. This is because many of the subtle patterns suggested by other bots, like leela_bot, appear in these swap maps. For example, on [https://pic3.zhimg.com/v2-53e66f72eb7129d5ffe676ae293ad856_r.jpg 13&times;13]:
 +
*** a1&ndash;c1 are stronger than d1; a2&ndash;c2 &ge; d2 &ge; e2 in strength; and a similar relation holds for moves on the third row. See [[Openings on 11 x 11#d2]].
 +
*** b4 is weaker than all of its neighbors, because Blue can fit the ziggurat in the corner.
 +
*** j3 is surprisingly weak and i3 is surprisingly strong. Many people were surprised about this when leela_bot's swap map came out, but the result may be more than just random noise.
 +
*** a10 is the weakest of a4&ndash;a10, while a5 is the strongest.
 +
*** b10 is stronger than all of its neighbors, because Blue cannot fit the ziggurat in the obtuse corner.
 +
** That this bot picked up on all these subtleties, and assigns a win percentage close to 100% for most moves on 13&times;13, suggest to me that it is probably stronger than leela_bot and gzero_bot. I can't know for sure, though.
 +
** On the other hand, and the author seems to agree, the 37&times;37 map looks very unreliable. I see percentages as low as 37% but only as high as 54% (for a move like f1, which should almost certainly be a losing move).
 +
** The 27&times;27 map looks more reliable. I'm personally very skeptical that moves on Red's 6th row are among the most balanced moves, but there are some interesting (if somewhat noisy) insights to be had still.
  
==Acute corner theory==
+
==Article ideas==
  
Corner joseki on 19&times;19 can be quite involved. Here's a sampler for inspiration.
+
* '''Motifs''' &mdash; very loosely related to joseki; small local patterns that occur in the middle of the board, usually representing optimal play from at least one side but not necessarily both sides
 
+
** Motifs have some notion of '''"local efficiency"''' (not to be confused with [[efficiency]]) &mdash; some motifs are, on average, good or bad for a particular player. Strong players anecdotally try to play locally efficient moves on large boards where calculating everything is impractical. It would be useful to have some of these rules of thumb written down. Can be thought of as a generalization of dead/captured cells, where LE(dead cell) = 0, and LE(X) &le; LE(Y) if Y capture-dominates X.
('''TODO''' elaborate, add diagrams)
+
** Here are some examples. In the first motif, Red 1 is often a weak move. Blue's best response is usually at a, or sometimes at b or c as part of a minimaxing play. But d is rarely (possibly never) the best move, because Red can respond with a, and Blue's central stone is now a dead stone. So, for any reasonable working definition of "local efficiency" LE, we have LE(d) < LE(a), and LE(b) = LE(c) due to symmetry. KataHex suggests that LE(b) < LE(a).
 
+
===5-4 acute corner===
+
 
+
* High intrusion is by far the most common: [https://hexworld.org/board/#19nc1,p15p16o16p14 here]
+
 
+
Blue typically doesn't play 4 if she already occupies the obtuse corner on that side, but in other cases it's often the best move. Other bots like leela_bot also play this joseki often, so even if the benefit of Blue 4 isn't immediately obvious to humans, the move still deserves serious consideration.
+
 
+
* An extended version: [https://hexworld.org/board/#19nc1,p15p16o16p14q14o17n17 here]
+
 
+
===6-5 acute corner===
+
 
+
* Low intrusion by Blue, high intrusion by Red: [https://hexworld.org/board/#19nc1,o14o16p16p15n16n17m17 here]
+
 
+
* A much longer variation: [https://hexworld.org/board/#19nc1,o14o16p16o17q17p18q18p15q13p17n16n15o15m18l17m16m17 here]
+
 
+
Blue has a couple ways to gain territory from Red 15, either playing at j18 or k19, but it seems better to defer the [[question]] and wait until one option is clearly preferable.
+
 
+
* High intrusion by Blue: [https://hexworld.org/board/#19nc1,o14o15p14p15n15m17l16m15m16k18q13p16j17k16k17 here]
+
 
+
Red 11 is a good minimaxing move, but he can only play it after Blue 10, since otherwise Blue has a [https://hexworld.org/board/#19nc1,o14o15p14p15n15m17q13l18 strong minimaxing reply].
+
 
+
===7-6 acute corner===
+
 
+
* Here's a standard one that KataHex prefers: [https://hexworld.org/board/#19nc1,n13n15o15n16p16p17r17q18o17 here]
+
 
+
==Obtuse corner theory==
+
 
+
===4-4 obtuse corner===
+
 
+
It's highly instructive to go through the many possible Blue responses to Red 4-4 in the obtuse corner.
+
 
+
<hexboard size="7x7"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R d4 E A:c5 B:d3 C:e3 D:e2 E:f2 F:d6 G:c6 H:b6 I:e5 J:d5 K:e4"
+
  />
+
 
+
'''A:''' KataHex's favorite response on 19&times;19 by far. Blue's move 3 gives her a 3rd row ladder escape in the form of [[edge template III2a]].
+
 
+
<hexboard size="7x7"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R d4 B 1:c5 R 2:d5 B 3:c6 R 4:d6"
+
  />
+
 
+
Unless Red's acute corner is free, Red usually connects directly to the bottom with move 4. This may be counterintuitive since it goes against the principle of minimaxing, but most Red attempts to minimax allow Blue to gain territory. For instance, if Red plays at 4 below, Blue gets move 7 for free, and the result is favorable to Blue.
+
 
+
<hexboard size="7x7"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R d4 B 1:c5 R 2:d5 B 3:c6 R 4:e5 B 5:d7 R 6:f6 B 7:f5 R 8:e6"
+
  />
+
 
+
If the acute corner is free, Red can play an alternative joseki on move 4:
+
 
+
<hexboard size="7x19"
+
  coords="hide"
+
  edges="bottom left right"
+
  contents="R d4 B 1:c5 R 2:d5 B 3:c6 R 4:p3 B 5:m5 R 6:q4"
+
  />
+
 
+
This joseki is quite tactical. After Blue's move 3, Red has a third row ladder from the obtuse corner, even if he plays elsewhere, but no ladder escape. Instead of connecting outright, Red plays 4 to give himself a ladder escape at a distance. Blue can defend the ladder by pushing for a few turns, but it's a mistake to push all the way to the acute corner where Red can escape the ladder. So, Blue jumps at a distance on move 5. Note that Blue deliberately chooses the 3-7 point, which works well against Red's 4.
+
 
+
After Red responds at 6, Blue has several reasonable options. Blue can push the ladder defensively, which Red can't escape outright because of Blue 5, but eventually Red can climb or carry out a complex switchback with the help of 4 and 6 (neither of which are overly strong for Red). Alternatively, Blue can start a fight in the acute corner for territory or ladder escapes. Since this is a joseki, it represents excellent play by both sides without big mistakes, but the exact best continuation will depend on the surrounding board situation.
+
 
+
'''B:''' Interestingly, this move is relatively common on 11&times;11 but not 13&times;13. The usual purpose of this move is to block Red from playing at (+) below. It appears slightly worse than move '''A''', but it's still very playable. Red has many reasonable responses marked (*):
+
 
+
<hexboard size="7x7"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R d4 B 1:d3 E +:e2 *:(c4 e3 f2)"
+
  />
+
 
+
'''C:''' This move is often effective on smaller boards when Blue has a ladder escape at her acute corner. However, the acute corner is much farther away on 19&times;19, and Blue's 5th row ladder is much less threatening, so Blue gains less from playing this move. Red, who is defending the ladder, usually pushes the ladder by playing at (*) below, or he jumps a couple hexes forward on the 3rd or 5th row (either immediately or after pushing a few times), indicated by (+):
+
 
+
<hexboard size="8x7"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R d5 B 1:e4 E *:d4 +:(c3 e2)"
+
  />
+
 
+
'''D:''' This blocking move is common on 13&times;13 but less so on 19&times;19. Blue's idea, if Red ignores the threat, is to follow up with this move 2, which is quite strong since it neutralizes Red's 4-4 stone significantly:
+
 
+
<hexboard size="7x7"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R d4 B 1:e2 2:f3"
+
  />
+
 
+
Indeed, Red usually responds to the threat, and the following sequence is a common joseki on 13&times;13:
+
 
+
<hexboard size="8x7"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R d5 B 1:e3 R 2:c4 B 3:d2 R 4:e2 B 5:d3 E *:b3 +:b4 -:f3"
+
  />
+
 
+
Red 6 is often at one of (*), (+), or (-). The move (*) allows Red to gain territory, while (+) creates a [[Flank#Capped_flank|capped flank]] that blocks Blue 3rd row ladders under Red's 4-4 stone. It's not obvious to me why, but KataHex tends to think Red is slightly better after this sequence on 19&times;19, so Blue usually doesn't play '''D''' in the first place.
+
 
+
'''E:''' Usually not the best move for Blue. Depending on local tactics, Red should either tenuki, or play one of (*):
+
 
+
<hexboard size="7x7"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R d4 B 1:f2 E *:(e2 c2)"
+
  />
+
 
+
'''F:''' This 4-2 obtuse corner block is strong on small boards like 11&times;11, but it's rarely a good move on 19&times;19, whether as the first stone in the obtuse corner, or in response to 4-4. There are exceptions &mdash; the 4-2 move works well in combination with a "middle of third row" opening stone, for example. Red would do well to connect directly with 2:
+
 
+
<hexboard size="7x7"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R d4 B 1:d6 R 2:c6"
+
  />
+
 
+
'''G:''' This block is a "surprise weapon" of sorts &mdash; it's a weak move on an empty board, but for local tactical reasons it can be very strong. The standard example is with the q2 opening, where an unsuspecting Blue who plays 4-4 in response is faced with an unpleasant surprise (more on that later).
+
  
 
<hexboard size="5x5"
 
<hexboard size="5x5"
   coords="hide"
+
   coords="none"
   edges="top right"
+
   edges="none"
   contents="R c2 B 1:b4 R 2:d3"
+
   contents="R b3 B c3 R 1:d2 E a:c2 b:b4 c:d3 d:c4"
 
   />
 
   />
  
Move '''G''' is also a threat if Blue already has a stone in either of (*) below.
+
Sometimes, a player will attempt to minimax by placing two stones adjacent to each other, like the unmarked blue stones below. (This is a common human mistake on 19&times;19; adjacent stones are typically less locally efficient than stones a bridge apart.) Red has several options, such as the adjacent block (*), though a far block is often possible too. It would be enlightening to know, absent other considerations, which block is the most "efficient" for Red, so that on a large board, Red could play this block without thinking too hard. Of course, in general the best move depends on the other stones on the board, and there's no move that strictly dominates another. The best move may even plausibly be to "[[tenuki|play elsewhere]]." Provisionally, KataHex thinks playing at one of A, or the far block at B, is a better first move for Red.
  
<hexboard size="7x7"
+
<hexboard size="4x4"
   coords="hide"
+
   coords="none"
   edges="bottom left"
+
   edges="none"
   contents="R d4 E *:(e5 f6) G:c6"
+
   contents="B b1 c1 E *:c2 A:(a1 d1) B:a4"
 
   />
 
   />
  
If '''G''' is played, Red should consider blocking the 3rd row ladder at a, or minimaxing at b.
+
==Recursive swap==
 +
Not really a serious suggestion, just for fun. One advantage of "recursive swap" over multi-stone swap is that opening preparation plays a smaller role, because both players have control over the first n stones.
  
<hexboard size="7x7"
+
RECURSIVE_SWAP'[k, depth, color]:
  coords="hide"
+
  if depth = 0:
  edges="bottom left"
+
    [color] continues playing as normal.
  contents="R d4 B 1:c6 E a:b6 b:c3"
+
  else:
  />
+
    [color] plays a move. [~color] can either
 +
      swap[k], or
 +
      RECURSIVE_SWAP'[k+1, depth-1, ~color]
 +
 +
RECURSIVE_SWAP[n]:
 +
  RECURSIVE_SWAP'[1, n, Red]
  
'''H:''' Another "surprise weapon," arguably even more so. Anecdotally, when KataHex thinks '''H''' is the best move in a position, it rarely assigns a high policy to the move, only liking the move after some search. In other words, KataHex's policy "intuition" rarely considers the move a top choice, or even top 10, until it realizes that the move works tactically in the particular situation.
+
RECURSIVE_SWAP[0]:
  
<hexboard size="7x7"
+
Red continues playing as normal.
  coords="hide"
+
  edges="bottom left"
+
  contents="R d4 B 1:b6 E *:d5"
+
  />
+
  
This 2-2 obtuse corner move typically works as an unusual minimaxing move, providing ladder escapes for Blue while simultaneously blocking Red and threatening a move like (*).
+
RECURSIVE_SWAP[1]:
  
'''I:''' This move is sometimes played on 13&times;13, but it rarely works on 19&times;19. The standard joseki is favorable to Red, probably because Blue 1 and 5 function mainly as a ladder escape blocker, and ladders/ladder escapes are themselves less important on 19&times;19.
+
Red plays a move. Blue can either
 +
* swap, or
 +
* continue playing as normal.
  
<hexboard size="7x7"
+
RECURSIVE_SWAP[2]:
  coords="hide"
+
  edges="bottom left"
+
  contents="R d4 B 1:e5 R 2:c4 B 3:c5 R 4:d5 B 5:d6 R 6:b5"
+
  />
+
  
'''J:''' Like many other Blue responses, this is a bad move in isolation. Red's 4-4 is already connected to the bottom via [[edge template IV1d]], so Blue attempts to block are futile unless she gets useful territory in exchange (like with '''A'''), but the territory gained by '''J''' is not nearly as good. However, this move can become useful if there are other blue stones present.
+
Red plays a move. Blue can either
 +
* swap, or
 +
* play a move, after which Red can either
 +
** swap2, or
 +
** continue playing as normal.
  
<hexboard size="7x7"
+
RECURSIVE_SWAP[3]:
  coords="hide"
+
  edges="bottom left"
+
  contents="R d4 B 1:d5 R 2:c5"
+
  />
+
  
'''K:''' Also a weak response. Can you see why?
+
Red plays a move. Blue can either
 +
* swap, or
 +
* play a move, after which Red can either
 +
** swap2, or
 +
** play a move, after which Blue can either
 +
*** swap3, or
 +
*** continue playing as normal.
  
<hexboard size="7x7"
+
===Analysis===
  coords="hide"
+
RECURSIVE_SWAP[0] is the same as playing with no swap.
  edges="bottom left"
+
  contents="R d4 B 1:e4 R 2:e2"
+
  />
+
  
Red 2 is strong, but that's not the only reason why. It turns out that had Blue played 1 first (before Red played the initial 4-4 stone), then a good Red response would be playing at 4-4. Going back to our general principles, it's a bad idea to play a move that would make your opponent's existing stone unnecessarily well-placed relative to yours, and that's exactly what '''K''' does.
+
RECURSIVE_SWAP[1] is the same as playing with the swap rule.
  
===5-5 obtuse corner===
+
RECURSIVE_SWAP[2]:
 +
* Red shouldn't play a move that's too strong or it'll be swapped.
 +
* If Red plays a weak stone, Blue should try to play a move just strong enough that Red will be indifferent to swap2. (If a "fair" move is half a stone, and Red plays a weak move worth x < 0.5 stones, Blue should play a move worth x + 0.5 stones.)
 +
* Red should try to play a weak move that's also hard for Blue to equalize (so that Red gets a sizable advantage when deciding whether to swap2 or not).
  
'''TODO'''
+
RECURSIVE_SWAP[3]:
 +
* If Red plays a move worth x > 0.5 stones, Blue should swap.
 +
* If Red plays a weak stone worth x < 0.5, Blue should play a move worth less than x + 0.5 (or else Red will swap2). If Blue's move is worth y, then Red should play a move as close to (y - x) + 0.5 as possible, so that Blue's swap3 decision is difficult.
 +
* Red should play a weak move that's hard for Blue to find a tricky reply to (where a "tricky" reply is one that makes it hard for Red to equalize, such that Blue has an easy time deciding whether to swap3 or not).
  
==The first move==
+
----
 +
HexWorld bugs:
  
See [[Swap_rule#Size_19]] for a swap map.
+
On 30x30, ad6 and ad11 are "dead" hexes that you can't click on. They don't show up even if you specify them in the url: [https://hexworld.org/board/#30,ad1ad2ad3ad4ad5ad6ad7ad8ad9ad10ad11ad12 here]. All other hexes look fine.
  
We'll now go through the general strategy of specific first moves. For simplicity, everything will be from Red's point of view, assuming Blue doesn't swap. Unlike the guides for smaller board sizes, we won't think too hard about ladder escapes or switchbacks, and instead we will just mention some brief notes for some selected openings.
+
On 31x31, the same clicking and url issue occurs for ad6, ad11, and ad31: [https://hexworld.org/board/#31,ad5ad6ad7ad11ad31ae1 here]
  
===Acute corner openings===
+
: Interesting. It turns out that this bug is caused by an ad blocker, in my case Adblock Plus, although Comonoid reproduced it with AdGuard as well. The ad blocker doesn't like column 30 because its name is "ad". It adds the following CSS rules, among thousands of others:
  
<hexboard size="5x5"
+
   ad6 {display: none !important;}
   coords="hide"
+
   ad11 {display: none !important;}
   edges="top left"
+
   ad31 {display: none !important;}
   contents="S red:all blue:(a1--e1 a2--e2 a3)
+
            E *:(c2 d3 e3 b4)"
+
  />
+
  
The stone in the acute corner affects which moves are locally efficient for Red and Blue.
+
: That's why those 3 cells are disabled, and no others! I will fix the bug soon.  
  
====c2====
+
: By the way, your HexWiki user page might not be the most efficient place to report a bug. [[User:Selinger|Selinger]] ([[User talk:Selinger|talk]]) 22:21, 20 April 2024 (UTC)
  
On 13&times;13, b5 or c6, marked with (*) below, are common Red moves that combine well with c2. On 19&times;19, these moves are a bit too close to the corner. Playing a bit further along the b5-c6 diagonal, such as A or B below, is often a better move:
+
----
  
<hexboard size="9x6"
+
[[User:Fjan2ej57w|Fjan2ej57w]]'s question 7, "how much space of an empty board would be filled if both sides play optimally":
  coords="show"
+
  edges="top left"
+
  contents="R c2 E *:(b5 c6) A:d7 B:e8"
+
  />
+
  
====b4====
+
[https://mathoverflow.net/questions/302821/length-of-optimal-play-in-hex-as-a-function-of-size Stack Overflow answer] for reference. My conjecture is that Hex without swap asymptotically requires Θ(n^2) cells, and more generally, a Demer handicap of Θ(f(n)) stones requires Θ(n^2/f(n)) cells, for all f(n) between Θ(1) and Θ(n). My intuition is that on 1000000&times;1000000 Hex, the first-player advantage is minuscule, and even a handicap of n^(1/2) = 1000 stones, say spaced out evenly across the short diagonal, would require on the order of "1000 columns and 1000000 rows", n^(3/2), to convert to a final connection. Another interesting question is to find a constructive winning strategy with an o(n) (sub-linear) handicap.
 
+
Under the right circumstances, Blue c2 (followed by Red tenuki) can be a good local response, though this happens less in the early opening.
+
 
+
====e3====
+
 
+
e3 is notable because KataHex thinks it's the fairest opening with the swap rule, with KataHex assigning a 49.2% win percentage for Blue, assuming no swap, after 100k visits.
+
 
+
===First column openings===
+
 
+
If Red starts with a move near the middle of his first column, like a10, a good followup for Red is to play one of the hexes marked A or B, or sometimes C (or both). These moves combine very efficiently with the opening stone to split up Blue's edge. KataHex nearly always plays one of these in the early opening.
+
 
+
<hexboard size="7x5"
+
  coords="hide"
+
  edges="left"
+
  contents="R a4 E A:b5 B:c6 C:b2"
+
  />
+
 
+
If Red plays at A or C, Blue often peeps in Red's bridge, as follows. Red typically responds at one of the hexes marked (*) or elsewhere, instead of defending the bridge.
+
 
+
<hexboard size="7x5"
+
  coords="hide"
+
  edges="left"
+
  contents="R a4 1:b5 B 2:b4 E *:(b2 c6)"
+
  />
+
 
+
====a10&ndash;a15====
+
 
+
Some of the fairer openings in this category are a10, a14, a15. Blue's best response to a10&ndash;a15 in the obtuse corner is usually 4-4, but there's no rush to play it:
+
 
+
<hexboard size="7x6"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R a2 B 1:d4"
+
  />
+
 
+
On 19&times;19, a15 is weaker than it looks, because the 4-2 obtuse corner, marked (*) below, is less potent for Red than on smaller boards:
+
 
+
<hexboard size="6x5"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R a2 E *:b3"
+
  />
+
 
+
====a16====
+
 
+
a16 is also a relatively fair opening. Blue can play 2-2 obtuse corner like on smaller boards, but it's less clearly the best option. The 4-4 obtuse corner also works, and if Blue instead waits for Red to play 1 as follows, then Blue 2 is a strong response.
+
 
+
<hexboard size="7x5"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R a4 1:b2 B 2:b5"
+
  />
+
 
+
===Obtuse corner openings===
+
 
+
There are several openings that affect play in the obtuse corner, but they are quite different from each other so we'll consider them separately.
+
 
+
====a19====
+
 
+
A common joseki for Red is to play at 1, which is basically the 4-4 opening shifted up one row. Blue often responds at 2, and Red has a couple good responses marked (*):
+
 
+
<hexboard size="6x6"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R a6 1:d2 B 2:c4 E *:(b4 c1)"
+
  />
+
 
+
My subjective opinion is that this is the most beginner-friendly opening:
+
 
+
* A beginner who opens with Red c2 could accidentally play b3 instead, or alternatively his opponent who wishes to swap Red c2 could implement swap-pieces incorrectly and replace it with Blue c2 instead of b3. Though a19 should technically be swapped to s1 under the swap-pieces convention, it doesn't really matter.
+
 
+
* Aesthetically, a19 retains the "most" symmetry of any fair opening. Beginners who don't want to think about the swap rule could play Hex without swap, where Red must open in an obtuse corner, and such a ruleset would be quite elegant and still balanced, even on large boards.
+
 
+
* For beginners who don't want to learn too much opening theory, "obtuse corner" is easy to remember and a good [https://en.wikipedia.org/wiki/Focal_point_(game_theory) Schelling point]. It's relatively likely that other beginners who look at the swap map and just want to try a random opening will pick a19 or s1.
+
 
+
====q2====
+
 
+
If Red opens q2, the most important advice for Blue is to refrain from playing 4-4 in the nearby obtuse corner, because of Red's strong response:
+
 
+
<hexboard size="7x6"
+
  coords="hide"
+
  edges="top right"
+
  contents="R d2 B 1:c4 R 2:e3 B 3:d5 R 4:f4 B 5:e6 R 6:d6 B 7:e5 R 8:c5 B 9:d4"
+
  />
+
 
+
====b17====
+
 
+
For the adventurous, while b17 should be swapped, it is weaker than it looks and quite playable. It's not overly strong, because Blue can play b18, either immediately or later. I consider it the obtuse-corner analog of b4, which is surprisingly weak because of the threat of Blue c2.
+
 
+
<hexboard size="5x5"
+
  coords="hide"
+
  edges="bottom left"
+
  contents="R b3 B 1:b4"
+
  />
+
 
+
===Third and fourth row openings===
+
 
+
According to KataHex, the fairest openings in this category are e3 (mentioned above), n3, and p3.
+
 
+
Openings in the middle of Red's 4th row are surprisingly playable, but most people prefer not to have their opening stone swapped, and playing against a 4th row opening stone can seem daunting, so a 3rd row opening is often preferable. If you strongly prefer having the first stone, or you think your opponent is overly eager to swap, you can play a weaker opening like g3 or h3.
+
 
+
Third row openings, especially those near an obtuse corner (except p3), tend to combine well with the 4-2 obtuse corner move:
+
 
+
<hexboard size="5x7"
+
  coords="hide"
+
  edges="top right"
+
  contents="R b3 1:f4"
+
  />
+
  
[[category: Opening]]
+
reply by [[User:Demer|Demer]]: ​ ​ ​ ​ ​ ​ ​ Even one with ​ n/6 - ω(1) ​ handicap would be interesting. ​ ​ ​ (improving on ​ https://webdocs.cs.ualberta.ca/~hayward/papers/handicap.pdf )
[[category: Advanced Strategy]]
+

Revision as of 04:16, 25 April 2024

Openings on 19 x 19

Strategic advice from KataHex

I started learning Hex mid-July of 2021, about 2 weeks before I created my LittleGolem account.

Insights and tidbits from KataHex (hzy's bot)

  • katahex_model_20220618.bin.gz (I'll call this the "strong" net) appears significantly stronger than the "default" net.
  • Swap map for 19×19 generated with the strong net, with around 15k visits for most moves. For the red hexes, the number corresponds to Blue's Elo advantage if she swaps Red's move; for the blue hexes, the number corresponds to Blue's Elo advantage if she does not swap Red's move. Smaller numbers correspond to fairer openings. Includes all fair openings as well as a few selected unfair openings, including the strongest move without swap (e10). I used more visits for the fairest moves: 1000k for e3 (49.5% win rate), 500k for n3 (49.2%), 100k for a15 (52.5%).
    • Key takeaways: The swap map at Swap rule#Size 19 uses data that is almost certainly from the "weak" net. Compared to the weak net, the strong net notably thinks a19, n3—p3, and k4—l4 are stronger. I personally trust the strong net's evaluations more; I think it's dubious that the weak net thought l4 was a very fair opening. The nets disagree on whether e3 is winning or losing, though it's so close to 50% that the difference isn't meaningful.
abcdefghijklmnopqrs1234567891011121314151617181956776756691741006537376738490103104496475996110837372678194571361793569578131819981413823824181998113178955693171365794816772738311096594764910410390847376733651001746956677756

Random unsolved questions

Most of these are very difficult to answer, and I would be happy if even a few were answered in the next few years:

  • Is the obtuse corner always winning on larger board sizes? What about the b4 opening? Let P(n) be the statement that "the obtuse corner is a winning opening in n×n Hex without swap." There are a few possible cases; an interesting exercise is to come up with subjective probabilities of each case being true.
    • A. P(n) is always true. If so, can we prove this?
    • B. P(n) is true for infinitely many n, with finitely many counterexamples. If so, what's the smallest counterexample?
    • C. P(n) is true for infinitely many n, with infinitely many counterexamples. If so, does P(n) hold "almost always," "almost never," or somewhere in between?
    • D. P(n) is true for finitely many n. If so, what's the largest such n?
  • Kriegspiel Hex (Dark Hex), a variant with incomplete information
    • Under optimal mixed strategies, what is Red's win probability on 4×4?
    • For larger boards (say, 19×19), is Red's win probability close to 50%?
      • If so, a swap rule might not be needed for Kriegspiel Hex, which would be neat.
      • If not, imagine a variant where Red's first move is publicly announced to both players, and Blue has the option to swap it. Which initial moves are the fairest now?


replies by Demer:

  • https://zhuanlan.zhihu.com/p/476464087 has percentages, although it doesn't translate these into a guessed swap map and I don't know anything about the bot they came from.
    • ​ It suggests that [on 13x13, g3 is the most balanced opening] and [on 14x14, g3 should not be swapped].
    • On 27x27 without swap, it likes the 4-4 obtuse corner opening slightly more than anything else nearby.
  • As far as I'm aware, even 3×4 Dark Hex has not been solved. ​ (https://content.iospress.com/articles/icga-journal/icg180057 apparently gives "some preliminary results" for that size.)

hexanna:

  • Thank you, this is amazing! From the Google Translate, the bot is an adaptation of KataGo trained on 13×13 and smaller, using transfer learning to train larger nets on top of the 13×13 net for a short period of time. I may edit the swap rule article later with some insights.
    • The results for up to 15×15 look very reliable to me. This is because many of the subtle patterns suggested by other bots, like leela_bot, appear in these swap maps. For example, on 13×13:
      • a1–c1 are stronger than d1; a2–c2 ≥ d2 ≥ e2 in strength; and a similar relation holds for moves on the third row. See Openings on 11 x 11#d2.
      • b4 is weaker than all of its neighbors, because Blue can fit the ziggurat in the corner.
      • j3 is surprisingly weak and i3 is surprisingly strong. Many people were surprised about this when leela_bot's swap map came out, but the result may be more than just random noise.
      • a10 is the weakest of a4–a10, while a5 is the strongest.
      • b10 is stronger than all of its neighbors, because Blue cannot fit the ziggurat in the obtuse corner.
    • That this bot picked up on all these subtleties, and assigns a win percentage close to 100% for most moves on 13×13, suggest to me that it is probably stronger than leela_bot and gzero_bot. I can't know for sure, though.
    • On the other hand, and the author seems to agree, the 37×37 map looks very unreliable. I see percentages as low as 37% but only as high as 54% (for a move like f1, which should almost certainly be a losing move).
    • The 27×27 map looks more reliable. I'm personally very skeptical that moves on Red's 6th row are among the most balanced moves, but there are some interesting (if somewhat noisy) insights to be had still.

Article ideas

  • Motifs — very loosely related to joseki; small local patterns that occur in the middle of the board, usually representing optimal play from at least one side but not necessarily both sides
    • Motifs have some notion of "local efficiency" (not to be confused with efficiency) — some motifs are, on average, good or bad for a particular player. Strong players anecdotally try to play locally efficient moves on large boards where calculating everything is impractical. It would be useful to have some of these rules of thumb written down. Can be thought of as a generalization of dead/captured cells, where LE(dead cell) = 0, and LE(X) ≤ LE(Y) if Y capture-dominates X.
    • Here are some examples. In the first motif, Red 1 is often a weak move. Blue's best response is usually at a, or sometimes at b or c as part of a minimaxing play. But d is rarely (possibly never) the best move, because Red can respond with a, and Blue's central stone is now a dead stone. So, for any reasonable working definition of "local efficiency" LE, we have LE(d) < LE(a), and LE(b) = LE(c) due to symmetry. KataHex suggests that LE(b) < LE(a).
a1cbd

Sometimes, a player will attempt to minimax by placing two stones adjacent to each other, like the unmarked blue stones below. (This is a common human mistake on 19×19; adjacent stones are typically less locally efficient than stones a bridge apart.) Red has several options, such as the adjacent block (*), though a far block is often possible too. It would be enlightening to know, absent other considerations, which block is the most "efficient" for Red, so that on a large board, Red could play this block without thinking too hard. Of course, in general the best move depends on the other stones on the board, and there's no move that strictly dominates another. The best move may even plausibly be to "play elsewhere." Provisionally, KataHex thinks playing at one of A, or the far block at B, is a better first move for Red.

AAB

Recursive swap

Not really a serious suggestion, just for fun. One advantage of "recursive swap" over multi-stone swap is that opening preparation plays a smaller role, because both players have control over the first n stones.

RECURSIVE_SWAP'[k, depth, color]:
  if depth = 0:
    [color] continues playing as normal.
  else:
    [color] plays a move. [~color] can either
      swap[k], or
      RECURSIVE_SWAP'[k+1, depth-1, ~color]

RECURSIVE_SWAP[n]:
  RECURSIVE_SWAP'[1, n, Red]

RECURSIVE_SWAP[0]:

Red continues playing as normal.

RECURSIVE_SWAP[1]:

Red plays a move. Blue can either

  • swap, or
  • continue playing as normal.

RECURSIVE_SWAP[2]:

Red plays a move. Blue can either

  • swap, or
  • play a move, after which Red can either
    • swap2, or
    • continue playing as normal.

RECURSIVE_SWAP[3]:

Red plays a move. Blue can either

  • swap, or
  • play a move, after which Red can either
    • swap2, or
    • play a move, after which Blue can either
      • swap3, or
      • continue playing as normal.

Analysis

RECURSIVE_SWAP[0] is the same as playing with no swap.

RECURSIVE_SWAP[1] is the same as playing with the swap rule.

RECURSIVE_SWAP[2]:

  • Red shouldn't play a move that's too strong or it'll be swapped.
  • If Red plays a weak stone, Blue should try to play a move just strong enough that Red will be indifferent to swap2. (If a "fair" move is half a stone, and Red plays a weak move worth x < 0.5 stones, Blue should play a move worth x + 0.5 stones.)
  • Red should try to play a weak move that's also hard for Blue to equalize (so that Red gets a sizable advantage when deciding whether to swap2 or not).

RECURSIVE_SWAP[3]:

  • If Red plays a move worth x > 0.5 stones, Blue should swap.
  • If Red plays a weak stone worth x < 0.5, Blue should play a move worth less than x + 0.5 (or else Red will swap2). If Blue's move is worth y, then Red should play a move as close to (y - x) + 0.5 as possible, so that Blue's swap3 decision is difficult.
  • Red should play a weak move that's hard for Blue to find a tricky reply to (where a "tricky" reply is one that makes it hard for Red to equalize, such that Blue has an easy time deciding whether to swap3 or not).

HexWorld bugs:

On 30x30, ad6 and ad11 are "dead" hexes that you can't click on. They don't show up even if you specify them in the url: here. All other hexes look fine.

On 31x31, the same clicking and url issue occurs for ad6, ad11, and ad31: here

Interesting. It turns out that this bug is caused by an ad blocker, in my case Adblock Plus, although Comonoid reproduced it with AdGuard as well. The ad blocker doesn't like column 30 because its name is "ad". It adds the following CSS rules, among thousands of others:
 ad6 {display: none !important;}
 ad11 {display: none !important;}
 ad31 {display: none !important;}
That's why those 3 cells are disabled, and no others! I will fix the bug soon.
By the way, your HexWiki user page might not be the most efficient place to report a bug. Selinger (talk) 22:21, 20 April 2024 (UTC)

Fjan2ej57w's question 7, "how much space of an empty board would be filled if both sides play optimally":

Stack Overflow answer for reference. My conjecture is that Hex without swap asymptotically requires Θ(n^2) cells, and more generally, a Demer handicap of Θ(f(n)) stones requires Θ(n^2/f(n)) cells, for all f(n) between Θ(1) and Θ(n). My intuition is that on 1000000×1000000 Hex, the first-player advantage is minuscule, and even a handicap of n^(1/2) = 1000 stones, say spaced out evenly across the short diagonal, would require on the order of "1000 columns and 1000000 rows", n^(3/2), to convert to a final connection. Another interesting question is to find a constructive winning strategy with an o(n) (sub-linear) handicap.

reply by Demer: ​ ​ ​ ​ ​ ​ ​ Even one with ​ n/6 - ω(1) ​ handicap would be interesting. ​ ​ ​ (improving on ​ https://webdocs.cs.ualberta.ca/~hayward/papers/handicap.pdf )