11
13
15
19
read: load merge
read: load merge
AHex
version 1.0
AHex is a browser-based tool for displaying and analyzing Hex games. AHex supports navigating through a graph of positions and performs minimax calculation based on the user's evaluations of terminal positions in the graph. I say 'graph' rather than 'tree' and 'terminal positions' rather than 'leaf nodes' because transpositions create a structure with branches that can rejoin: a directed acyclic graph.
The most recently played move in a position is highlighted in red. Multiple red cells indicate multiple game histories leading to the current position (transposition).
In positions with only one cell highlighed in red, clicking the <— button will navigate back one move in the graph.
When more than one cell is highlighted in red, click a red‑highlighted cell to navigate backward via the transposition of your choice. For consistency, clicking on a red‑highlighed cell navigates back even when there's only one red cell on the board.
Moves forward from a position are shown as rings (hollow stones) in cells. Clicking on a cell with a ring will navigate forward to the position reached by playing a stone in that cell. When there's only one way forward (only one ring shown on the board), clicking the —> button will navigate forward via that move.
Click any empty cell to play a move and add its position to the graph.
Clicking the delete button removes the current position from the graph. delete is grayed out (unavailable) for all but terminal positions.
Clicking the branch<— or —>branch button navigates backward or forward as far as possible until a position with multiple moves forward is reached. branch<— will also stop when reaching a position with multiple predecessors (transposition).
Clicking the start<— button navigates backward to the start of the game.
Clicking the adv. white or adv. black button marks a terminal position as advantageous to white or black, respectively. Advantages are automatically propagated to preceding positions in the graph (minimax).
AHex discards any advantage applied to a position once the position has descendants and it is assigned an evaluation as calculated by minimax. By comparison, jHex (a Java program for analyzing Hex games) quietly retains the advantage assigned to a position even after further moves are played from that position; its assigned advantage will reappear if the descendants are deleted.
A ring representing a move forward is marked with a plus or minus when the move leads to a position advantageous or disadvantageous to the respective player. E.g., a white plus means the move is advantageous to white. In terminal positions, the user‑given evaluation advantage (if any) is marked with plus or minus in the red‑highlighted (most‑recenly played) stone(s).
Clicking the ☰ icon above the northwest corner of the board shows a drop‑down menu of function buttons as follows:
Clicking the new button in the drop‑down menu creates an empty graph of the selected size.
To read a graph previously saved to a file, click Choose File in the drop‑down menu and select the desired file. (The appearance of this button varies by browser; in Firefox it's Browse...) The only file format recognized for now is AHex's own format. There are two click-selectable options: load and merge. Load clears the graph before reading a file, whereas merge combines the existing graph with the graph read from a file. AHex will not merge graphs with mismatched board sizes.
When merging graphs with conflicting advantages assigned to terminal positions, the advantages read from the file replace the existing ones in the current graph.
Clicking write in the drop‑menu will write the current graph to a file. Use the text field adjacent to the write button to specify the name of the file to write. Browsers usually save files to a "Downloads" directory but this is configurable.
Clicking undo in the drop‑down menu will revert to the graph as it was before the most recent new/read/undo operation. undo is useful after a read operation has failed due to errors detected in the file. Only one graph can be restored, not a stack of them.
The read and write functions are mediated by your browser's upload/download facilities. Although the files AHex writes are plain ASCII text, they are labeled "application/octet‑stream" to coax browsers into saving them rather than offering you the choice to open them with a text editor.
AHex doesn't need an Internet connection. You can save its HTML to a file and bring it up in a browser at any time. It is self‑contained: it doesn't require any stylesheets, scripts, or images from other files.
Files written by AHex record the graph's nodes (positions) but not the edges (moves) connecting them. The edges are derived by AHex each time a file is read: an O(n²) operation. AHex takes less than one second to process a file with 10,000 positions when running on my desktop computer and about two seconds on my Android phone. If you start working with graphs larger than that, please let me know.
To analyze a Hex game played on littlegolem.net, enter the game number in the form at https://minortriad.com/ahexlg.html or click the "Analyze game on minortriad.com" link on a LittleGolem Hex game page (thanks Richard!). To start AHex with a blank board, go to https://minortriad.com/ahex.html
AHex is a work in progress. I plan to support more features in future releases. Bug reports, comments, requests: email me or message me on LittleGolem.
Copyright 2020 Thomas E. Ace. AHex is free software with no warranty, licensed under a Creative Commons Attribution-NonCommercial 4.0 International license.
Privacy notice: minortriad.com maintains logs of HTTP/HTTPS requests, never shared with anyone. Its pages don't use cookies nor any other tracking mechanisms.
AHex is a browser-based tool for displaying and analyzing Hex games. AHex supports navigating through a graph of positions and performs minimax calculation based on the user's evaluations of terminal positions in the graph. I say 'graph' rather than 'tree' and 'terminal positions' rather than 'leaf nodes' because transpositions create a structure with branches that can rejoin: a directed acyclic graph.
The most recently played move in a position is highlighted in red. Multiple red cells indicate multiple game histories leading to the current position (transposition).
In positions with only one cell highlighed in red, clicking the <— button will navigate back one move in the graph.
When more than one cell is highlighted in red, click a red‑highlighted cell to navigate backward via the transposition of your choice. For consistency, clicking on a red‑highlighed cell navigates back even when there's only one red cell on the board.
Moves forward from a position are shown as rings (hollow stones) in cells. Clicking on a cell with a ring will navigate forward to the position reached by playing a stone in that cell. When there's only one way forward (only one ring shown on the board), clicking the —> button will navigate forward via that move.
Click any empty cell to play a move and add its position to the graph.
Clicking the delete button removes the current position from the graph. delete is grayed out (unavailable) for all but terminal positions.
Clicking the branch<— or —>branch button navigates backward or forward as far as possible until a position with multiple moves forward is reached. branch<— will also stop when reaching a position with multiple predecessors (transposition).
Clicking the start<— button navigates backward to the start of the game.
Clicking the adv. white or adv. black button marks a terminal position as advantageous to white or black, respectively. Advantages are automatically propagated to preceding positions in the graph (minimax).
AHex discards any advantage applied to a position once the position has descendants and it is assigned an evaluation as calculated by minimax. By comparison, jHex (a Java program for analyzing Hex games) quietly retains the advantage assigned to a position even after further moves are played from that position; its assigned advantage will reappear if the descendants are deleted.
A ring representing a move forward is marked with a plus or minus when the move leads to a position advantageous or disadvantageous to the respective player. E.g., a white plus means the move is advantageous to white. In terminal positions, the user‑given evaluation advantage (if any) is marked with plus or minus in the red‑highlighted (most‑recenly played) stone(s).
Clicking the ☰ icon above the northwest corner of the board shows a drop‑down menu of function buttons as follows:
Clicking the new button in the drop‑down menu creates an empty graph of the selected size.
To read a graph previously saved to a file, click Choose File in the drop‑down menu and select the desired file. (The appearance of this button varies by browser; in Firefox it's Browse...) The only file format recognized for now is AHex's own format. There are two click-selectable options: load and merge. Load clears the graph before reading a file, whereas merge combines the existing graph with the graph read from a file. AHex will not merge graphs with mismatched board sizes.
When merging graphs with conflicting advantages assigned to terminal positions, the advantages read from the file replace the existing ones in the current graph.
Clicking write in the drop‑menu will write the current graph to a file. Use the text field adjacent to the write button to specify the name of the file to write. Browsers usually save files to a "Downloads" directory but this is configurable.
Clicking undo in the drop‑down menu will revert to the graph as it was before the most recent new/read/undo operation. undo is useful after a read operation has failed due to errors detected in the file. Only one graph can be restored, not a stack of them.
The read and write functions are mediated by your browser's upload/download facilities. Although the files AHex writes are plain ASCII text, they are labeled "application/octet‑stream" to coax browsers into saving them rather than offering you the choice to open them with a text editor.
AHex doesn't need an Internet connection. You can save its HTML to a file and bring it up in a browser at any time. It is self‑contained: it doesn't require any stylesheets, scripts, or images from other files.
Files written by AHex record the graph's nodes (positions) but not the edges (moves) connecting them. The edges are derived by AHex each time a file is read: an O(n²) operation. AHex takes less than one second to process a file with 10,000 positions when running on my desktop computer and about two seconds on my Android phone. If you start working with graphs larger than that, please let me know.
To analyze a Hex game played on littlegolem.net, enter the game number in the form at https://minortriad.com/ahexlg.html or click the "Analyze game on minortriad.com" link on a LittleGolem Hex game page (thanks Richard!). To start AHex with a blank board, go to https://minortriad.com/ahex.html
AHex is a work in progress. I plan to support more features in future releases. Bug reports, comments, requests: email me or message me on LittleGolem.
Copyright 2020 Thomas E. Ace. AHex is free software with no warranty, licensed under a Creative Commons Attribution-NonCommercial 4.0 International license.
Privacy notice: minortriad.com maintains logs of HTTP/HTTPS requests, never shared with anyone. Its pages don't use cookies nor any other tracking mechanisms.