<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: HZY</title>
    <description>The latest articles on DEV Community by HZY (@hzyhhzy).</description>
    <link>https://dev.to/hzyhhzy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1966031%2F1d068701-a16f-49a0-9930-59dda05ca247.jpeg</url>
      <title>DEV Community: HZY</title>
      <link>https://dev.to/hzyhhzy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hzyhhzy"/>
    <language>en</language>
    <item>
      <title>Winner of Connect Four for every board size</title>
      <dc:creator>HZY</dc:creator>
      <pubDate>Sun, 13 Oct 2024 22:01:05 +0000</pubDate>
      <link>https://dev.to/hzyhhzy/winner-of-connect-four-for-every-board-size-188i</link>
      <guid>https://dev.to/hzyhhzy/winner-of-connect-four-for-every-board-size-188i</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F78vlhyb9zabwgmyynnm4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F78vlhyb9zabwgmyynnm4.png" alt="Image description" width="800" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>openings of Connect6</title>
      <dc:creator>HZY</dc:creator>
      <pubDate>Sun, 13 Oct 2024 21:35:27 +0000</pubDate>
      <link>https://dev.to/hzyhhzy/openings-of-connect6-4004</link>
      <guid>https://dev.to/hzyhhzy/openings-of-connect6-4004</guid>
      <description>&lt;p&gt;(TODO)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vk80wz00lgej1e69bv4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vk80wz00lgej1e69bv4.png" alt="Image description" width="800" height="803"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fceiacwpe9176bytvvvuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fceiacwpe9176bytvvvuv.png" alt="Image description" width="800" height="814"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1t0y6bwyfi0lvpq3y6s3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1t0y6bwyfi0lvpq3y6s3.png" alt="Image description" width="800" height="799"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hmxh5n94hoo9wyjdb4v.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9hmxh5n94hoo9wyjdb4v.jpg" alt="Image description" width="800" height="818"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgjkcpailt6gj3khv09o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgjkcpailt6gj3khv09o.png" alt="Image description" width="800" height="810"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2tlc04vju2c5oa6a860.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2tlc04vju2c5oa6a860.png" alt="Image description" width="800" height="790"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Analysis of the length of optimal games of Hex game using alphazero-like AI</title>
      <dc:creator>HZY</dc:creator>
      <pubDate>Sun, 08 Sep 2024 14:39:12 +0000</pubDate>
      <link>https://dev.to/hzyhhzy/analysis-of-the-length-of-optimal-games-of-hex-game-using-alphazero-like-ai-16n7</link>
      <guid>https://dev.to/hzyhhzy/analysis-of-the-length-of-optimal-games-of-hex-game-using-alphazero-like-ai-16n7</guid>
      <description>&lt;h1&gt;
  
  
  1.Introduction
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;Hex is a board game &lt;a href="https://en.wikipedia.org/wiki/Hex_(board_game)" rel="noopener noreferrer"&gt;Hex (board game)&lt;/a&gt;. &lt;br&gt;
It can be proven that the first player wins on boards with any size &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;×&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt; (without swap rule) using a non-constructive proof. But the proof cannot provide specific strategies of how to win. &lt;/p&gt;

&lt;h2&gt;
  
  
  Question
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://mathoverflow.net/questions/302821/length-of-optimal-play-in-hex-as-a-function-of-size/" rel="noopener noreferrer"&gt;Original question on MathOverflow&lt;/a&gt;&lt;br&gt;&lt;br&gt;
On an n×n board, assume the first player tries to minimize the length of the game to win, and the second player tries to maximize the length to lose. Call the optimal length F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;). (F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;) is the sum of move numbers of two player, not one player).&lt;br&gt;&lt;br&gt;
What are the asymptotics of F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;)?&lt;/p&gt;

&lt;h2&gt;
  
  
  Brief results
&lt;/h2&gt;

&lt;p&gt;The following results come from a strong Hex AI called KataHex. The AI and the raw data with visualization scripts are here: &lt;a href="https://github.com/hzyhhzy/KataGo/releases/tag/Hex_20240908" rel="noopener noreferrer"&gt;KataHex release&lt;/a&gt;. It's &lt;strong&gt;NOT a exhaustive search&lt;/strong&gt; so there is a small possibility to be wrong (but probably never). And it can't be called a "proof".   &lt;/p&gt;

&lt;p&gt;F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;) for &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;≤9 are pretty sure:&lt;br&gt;&lt;br&gt;
F(1)=1, F(2)=3, F(3)=5, F(4)=9, F(5)=13, F(6)=19, F(7)=25, F(8)=31, F(9)=37&lt;br&gt;&lt;br&gt;
For &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;≥10, the results in the figure below is just an estimated value , error is about ±0.04*&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;²&lt;br&gt;&lt;br&gt;
This shows that F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;) is probably O(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;²) (at least O(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;^1.9)), F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;) ≈ 0.425*&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;² + 0.515*&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0c8ku5pvamt3rnllfcqq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0c8ku5pvamt3rnllfcqq.png" alt="Estimated F(n) and fitted curve"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  2.Method
&lt;/h1&gt;

&lt;p&gt;KataGo is an opensource alphazero-like reinforcement learning AI for Go. &lt;a href="https://github.com/lightvector/KataGo/" rel="noopener noreferrer"&gt;KataGo source code&lt;/a&gt;   &lt;/p&gt;

&lt;p&gt;I modified KataGo to the Hex game and trained. &lt;a href="https://github.com/hzyhhzy/KataGo/tree/Hex2024" rel="noopener noreferrer"&gt;KataHex source code&lt;/a&gt; &lt;a href="https://github.com/hzyhhzy/KataGo/releases/tag/Hex_20240908" rel="noopener noreferrer"&gt;KataHex release&lt;/a&gt;&lt;br&gt;&lt;br&gt;
To estimate the move number required to win the game F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;), an extra "move number limit" rule was added: If neither player can connect before &lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt; moves, then the game is a draw.&lt;br&gt;&lt;br&gt;
Board size &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt; and move limit number &lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt; are randomly selected at the start of every self-play game for training. 1≤&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;≤27, 1≤&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;≤&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;²&lt;br&gt;&lt;br&gt;
After enough training, the AI become enough strong to provide relatively accurate estimations of F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;)&lt;/p&gt;

&lt;h1&gt;
  
  
  3.Result
&lt;/h1&gt;

&lt;h2&gt;
  
  
  3.1 Definations
&lt;/h2&gt;

&lt;p&gt;For any board size &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt; and move limit number &lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;, AI can estimate the win-rate of the first player &lt;strong&gt;w&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;), lose-rate of the first player &lt;strong&gt;l&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;) (the win-rate of the second player), and draw-rate &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;) (no player wins before &lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt; moves).&lt;br&gt;&lt;br&gt;
Since the AI is strong, &lt;strong&gt;l&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;) is very close to zero and can be ignored (especially for &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;≤19). &lt;strong&gt;w&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;) ≈ 1 - &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;) So we use &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;) as the criterion for F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;) estimation.&lt;br&gt;&lt;br&gt;
The winner is the first player, so the last move is the first player, F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;)  should be an odd number. So we can ignore even numbers for &lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
Obviously, for an infinitely strong AI, &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;) can only be 0 or 1 because of Zermelo’s theorem. If &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;)=0 and &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;-2)=1, then F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;)=&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;.   &lt;/p&gt;

&lt;h2&gt;
  
  
  3.2 Results of &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;) and F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;) estimation
&lt;/h2&gt;

&lt;p&gt;The AI always shows &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;)≈0 or &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;)≈1 for any &lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt; with &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;≤9 because AI can almost exhaustively calculate every valuable strategy, so we can get very accurate F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;) estimation for &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;≤9.&lt;br&gt;&lt;br&gt;
However, with &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;≥10, it becomes too difficult for the current version of AI. Here I used a threhold: If &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;)≤threhold and &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;-2)&amp;gt;threhold, then F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;)≈&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;. Here I used threhold=0.5&lt;/p&gt;

&lt;p&gt;Here is a heatmap of &lt;strong&gt;d&lt;/strong&gt;(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;,&lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;). Notice that y-axis is &lt;strong&gt;&lt;em&gt;m&lt;/em&gt;&lt;/strong&gt;/&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;² for better visualization.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fog3pumkc6hlmsjri62sj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fog3pumkc6hlmsjri62sj.png" alt="Draw-rate heatmap"&gt;&lt;/a&gt;&lt;br&gt;
F(1)=1, F(2)=3, F(3)=5, F(4)=9, F(5)=13, F(6)=19, F(7)=25, F(8)=31, F(9)=37&lt;br&gt;&lt;br&gt;
For &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;≥10, the error range is about ±0.04*&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;² (transition region from blue to yellow for &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;≥10 is about 0.08*&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;²)   &lt;/p&gt;

&lt;h2&gt;
  
  
  3.3 Example of optimal games
&lt;/h2&gt;

&lt;p&gt;Optimal games means every move is the best move. The first player tries to minimize the move number before winning, and the second player tries to maximize the move number before losing. The game length should be F(&lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;).&lt;br&gt;&lt;br&gt;
Optimal game of each board size is probably not unique (maybe millions or more). Here I just show one of them.   &lt;/p&gt;

&lt;p&gt;In the following games, black is the first player and black should connect up and down, white is the second player and should connect left and right.&lt;br&gt;&lt;br&gt;
Some of the moves near the end (after black having a "jump connection") are ignored because they are too simple.   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3mt0w56ti5i79tic3bs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc3mt0w56ti5i79tic3bs.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5x5 board: F(5)=13. Black needs 4 more stones to connect fully, so the final move num is 5+2*4=13&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fveeh772wrhj1dmoqwa4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fveeh772wrhj1dmoqwa4s.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6x6 board: F(6)=19. Black needs 4 more stones to connect fully, so the final move num is 11+2*4=19&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwxcrdduc7rflccnrd8vr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwxcrdduc7rflccnrd8vr.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
7x7 board: F(7)=25. Black needs 3 more stones to connect fully, so the final move num is 19+2*3=25&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzc9tqpkubkzyh8x8etag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzc9tqpkubkzyh8x8etag.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;8x8 board: F(8)=31. Black needs 6 more stones to connect fully, so the final move num is 19+2*6=31&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F52psoiqf27arkb6j6bhm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F52psoiqf27arkb6j6bhm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;9x9 board: F(9)=37. Black needs 7 more stones to connect fully, so the final move num is 23+2*7=37&lt;/p&gt;

&lt;h2&gt;
  
  
  3.4 Results of every first move on 9x9 and smaller boards
&lt;/h2&gt;

&lt;p&gt;"Swap after first move" is a popular rule for Hex to make the game more balanced. So the evaluation of every first move is necessary for human or bot competitions. Here the results(win or lose) and optimal game length are estimated for &lt;strong&gt;&lt;em&gt;n&lt;/em&gt;&lt;/strong&gt;≤9. &lt;strong&gt;The following results of &lt;em&gt;n&lt;/em&gt;=8 and &lt;em&gt;n&lt;/em&gt;=9 may be NOT 100% correct!&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
W+number means the first player(red) wins, L+number means the second player(blue) wins.  For example: W37 means the first player(red) will win in 37 moves. L38 means the second player(blue) will win in 38 moves.   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprhw8b6342btp1hhw2q8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprhw8b6342btp1hhw2q8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgrsqvqe853cv5jbok2gm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgrsqvqe853cv5jbok2gm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkgo70kukdwkir65sd4qb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkgo70kukdwkir65sd4qb.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzpqh9desjw0zpug91946.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzpqh9desjw0zpug91946.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F55x7h43dlzek78r4f4a3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F55x7h43dlzek78r4f4a3.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fghi4r4i1v65cvzi4g0hk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fghi4r4i1v65cvzi4g0hk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F92q1timc1brad8j088ks.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F92q1timc1brad8j088ks.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fclzq5jpvjewpb1qxlgk8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fclzq5jpvjewpb1qxlgk8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feezw0yppqvts3qqdxj77.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feezw0yppqvts3qqdxj77.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>math</category>
      <category>ai</category>
      <category>hex</category>
    </item>
    <item>
      <title>This is just a test</title>
      <dc:creator>HZY</dc:creator>
      <pubDate>Thu, 22 Aug 2024 17:15:43 +0000</pubDate>
      <link>https://dev.to/hzyhhzy/this-is-just-a-test-37gn</link>
      <guid>https://dev.to/hzyhhzy/this-is-just-a-test-37gn</guid>
      <description>&lt;p&gt;todo&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
