10 11 12 13 14 15 16 17 18 19
4 5 6 7 8 9 10 11
read: load merge
local storage:
local storage:
AHex
version 2.5
AHex is a browser-based tool for displaying and analyzing Hex and Havannah 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 br<— or —>br button navigates backward or forward as far as possible until a branch (a position with multiple moves forward) is reached. br<— will also stop when reaching a position with multiple predecessors (transposition).
Clicking the |<— button navigates backward to the start of the game.
AHex supports bookmarking positions to make them easy to return to. Click the mark button to mark the current position, and click the —>mark button to navigate to marked position(s), if any. The mark button will change to unmark when a marked position is displayed; clicking it will unmark the current position. The current position of play is automatically marked upon importing a game from LittleGolem.
Clicking the adv. w or adv. b 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‑recently played) stone(s).
AHex recognizes winning positions and automatically marks them as advantageous. Havannah wins are notated to indicate the type of win (Y, bridge, or ring).
Starting with version 2.3, AHex continues ladders in Hex games by clicking the right mouse button. The two previous moves must be adjacent. The code to recognize ladders might not always do what you want; if not, click delete to remove the stone it played. Try playing one more stone in the ladder and click the right mouse button again to give AHex another chance to recognize the ladder you had in mind.
Starting with version 2.3, AHex displays a clickable list of moves in a box to the right of the board. The move played to reach the currently-displayed position is marked with a lozenge symbol (⧫). Move numbers for marked positions are displayed in red.
Whatever move list is displayed represents only one possible sequence of moves through the graph. AHex uses rules in choosing which branches to follow: moves after the currently-displayed position that lead to a marked position are preferred over those that don't (consistent with how AHex chooses among multiple branches forward when you click the —> or —>br button); otherwise (starting with release 2.4), AHex chooses the most advantageous move (with ties broken by the branch leading to the most recently viewed position).
Starting with version 2.4, AHex recognizes keyboard shortcuts as follows:
To make it harder to cause changes by accident, shortcuts W, B, D, M, U, and L must be typed in upper case.
Four keyboard shortcuts match those supported by the Hex analysis tool at trmph.com: p (prev), n (next), f (first), l (last). Note that AHex doesn't have a button with the same function as "l" (navigate to the last position in the current move list); this is only available as a keyboard shortcut.
Clicking the ☰ icon above the northwest corner of the board shows a drop‑down menu of function buttons as follows:
AHex draws boards with either of two user‑selectable sizes of hexagon cells. The first button in the drop‑down menu will appear as zoom + or zoom – and allows you to switch from one size to the other.
The move list may be disabled by clicking hide move list and restored by clicking show move list in the drop‑down menu.
Display of move(s) forward from a position (drawn as rings) may be disabled by clicking hide rings and restored by clicking show rings in the drop‑down menu.
Clicking the new Hex button in the drop‑down menu creates an empty Hex graph of the selected size.
Clicking the new Havannah button in the drop‑down menu creates a fresh Havannah 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, nor will it merge a Havannah graph with a Hex graph.
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 also offers the option of reading/writing graphs to browser local storage. This provides a simpler user interface than filesystem read/write and it overwrites files rather than saving with a version number appended to the name. To use local storage, enter the name of the file to read/write/delete into the box next to "local storage:" in the drop-down menu, and click on any of the four buttons to the right: read (load) read (merge) write delete. To view and select from whatever files are already saved in browser local storage, click on the drop-down box underneath the box for the file name.
Browsers limit the size of local storage available to each web page. The limit varies by browser, but 5 megabytes is typical and is usually enough for graphs containing a total of 100,000 positions.
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. Please note, however, that browser local storage is specific to each web page. Local storage accessible from AHex loaded from a URL on minortriad.com is not the same storage accessible from a personal copy of AHex on your computer. Local storage is also browser- and computer-specific; data stored can't be accessed by a different browser nor by the same browser running on another computer.
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. AHex 2.1 (or later) takes about 1.5 seconds to process a file with 100,000 positions when running on my desktop computer and about 4 seconds on my Android phone. If you start working with graphs larger than that, please let me know because the code can be tuned further.
To analyze a Hex or Havannah 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.
version history:
© 2021 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 and Havannah 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 br<— or —>br button navigates backward or forward as far as possible until a branch (a position with multiple moves forward) is reached. br<— will also stop when reaching a position with multiple predecessors (transposition).
Clicking the |<— button navigates backward to the start of the game.
AHex supports bookmarking positions to make them easy to return to. Click the mark button to mark the current position, and click the —>mark button to navigate to marked position(s), if any. The mark button will change to unmark when a marked position is displayed; clicking it will unmark the current position. The current position of play is automatically marked upon importing a game from LittleGolem.
Clicking the adv. w or adv. b 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‑recently played) stone(s).
AHex recognizes winning positions and automatically marks them as advantageous. Havannah wins are notated to indicate the type of win (Y, bridge, or ring).
Starting with version 2.3, AHex continues ladders in Hex games by clicking the right mouse button. The two previous moves must be adjacent. The code to recognize ladders might not always do what you want; if not, click delete to remove the stone it played. Try playing one more stone in the ladder and click the right mouse button again to give AHex another chance to recognize the ladder you had in mind.
Starting with version 2.3, AHex displays a clickable list of moves in a box to the right of the board. The move played to reach the currently-displayed position is marked with a lozenge symbol (⧫). Move numbers for marked positions are displayed in red.
Whatever move list is displayed represents only one possible sequence of moves through the graph. AHex uses rules in choosing which branches to follow: moves after the currently-displayed position that lead to a marked position are preferred over those that don't (consistent with how AHex chooses among multiple branches forward when you click the —> or —>br button); otherwise (starting with release 2.4), AHex chooses the most advantageous move (with ties broken by the branch leading to the most recently viewed position).
Starting with version 2.4, AHex recognizes keyboard shortcuts as follows:
| ||||||||||||
| ||||||||||||
|
To make it harder to cause changes by accident, shortcuts W, B, D, M, U, and L must be typed in upper case.
Four keyboard shortcuts match those supported by the Hex analysis tool at trmph.com: p (prev), n (next), f (first), l (last). Note that AHex doesn't have a button with the same function as "l" (navigate to the last position in the current move list); this is only available as a keyboard shortcut.
Clicking the ☰ icon above the northwest corner of the board shows a drop‑down menu of function buttons as follows:
AHex draws boards with either of two user‑selectable sizes of hexagon cells. The first button in the drop‑down menu will appear as zoom + or zoom – and allows you to switch from one size to the other.
The move list may be disabled by clicking hide move list and restored by clicking show move list in the drop‑down menu.
Display of move(s) forward from a position (drawn as rings) may be disabled by clicking hide rings and restored by clicking show rings in the drop‑down menu.
Clicking the new Hex button in the drop‑down menu creates an empty Hex graph of the selected size.
Clicking the new Havannah button in the drop‑down menu creates a fresh Havannah 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, nor will it merge a Havannah graph with a Hex graph.
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 also offers the option of reading/writing graphs to browser local storage. This provides a simpler user interface than filesystem read/write and it overwrites files rather than saving with a version number appended to the name. To use local storage, enter the name of the file to read/write/delete into the box next to "local storage:" in the drop-down menu, and click on any of the four buttons to the right: read (load) read (merge) write delete. To view and select from whatever files are already saved in browser local storage, click on the drop-down box underneath the box for the file name.
Browsers limit the size of local storage available to each web page. The limit varies by browser, but 5 megabytes is typical and is usually enough for graphs containing a total of 100,000 positions.
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. Please note, however, that browser local storage is specific to each web page. Local storage accessible from AHex loaded from a URL on minortriad.com is not the same storage accessible from a personal copy of AHex on your computer. Local storage is also browser- and computer-specific; data stored can't be accessed by a different browser nor by the same browser running on another computer.
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. AHex 2.1 (or later) takes about 1.5 seconds to process a file with 100,000 positions when running on my desktop computer and about 4 seconds on my Android phone. If you start working with graphs larger than that, please let me know because the code can be tuned further.
To analyze a Hex or Havannah 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.
version history:
version | date | changes |
---|---|---|
1.0 | 24 Sep 2020 |
initial release |
2.0 | 8 Oct 2020 |
local storage, marked positions, Havannah |
2.1 | 11 Nov 2020 |
two zoom levels, all Hex board sizes from 10-19 |
2.2 | 4 Apr 2021 |
win detection, current position marked upon import from LG |
2.3 | 24 May 2021 |
move list, right-click to extend ladders |
2.4 | 28 Jun 2021 |
keyboard shortcuts, optional rings |
2.5 | 6 Jul 2021 |
preserves function of keystrokes modified by ctrl/alt/meta, bug fixes |
© 2021 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.