7. a draw white will be given half a point komi to make up for the disadvantage of playing
second. White will win if the game results in a draw.
● Player Input: a human player can be selected to play.
● Move evaluation: the value of a game state is given by the score of the player minus the
score of the opponent.
● Territory and Eye detection: In my implementation territory is defined as an eye. an
empty spot surrounded by 4 stones of the same color. Board edges are accounted for, a
corner eye only needs 2 stones.
4.2.2 Extra features
● Efficient move: a function that will perform further checks on move generation and
prevent it from doing moves that would be considered bad, such as filling own eyes
which eventually leads to suicide.
● Group management
○ Liberty counting: a group can find all its liberties. determining their location and
total number.
■ Atari detection: if a group has 1 liberty it is in atari.
○ Group size.
○ Group merging: if a stone is played nearby merge it with an existing group.
■ If a stone connects multiple groups, merge them all into 1.
○ Option to print all group information per turn is selectable in the main menu.
● Node counting for AI.
● Notification when an AI finds a better move (Minimax/AB)
● Print Information on the winrate of a move (Monte Carlo/UCT)
○ UCT Value of a move.
● Select one of the six predefined game settings for convenience and select which AI will
play each other in the main menu.
8. 5 Results
5.1 Minimax and AlphaBeta
● Table 1. Board size 9x9. Average node count.
Algorithm (depth) First Move (node visits) Total Moves (node visits)
Minimax (2) 500k 6m
AlphaBeta (2) 40k 600k
AlphaBeta (4) 4m 330m
● Table 2. Board size 5x5. Average node count.
Algorithm (depth) First Move (node visits) Total Moves (node visits)
Minimax (2) 13k 60k
Minimax (4) 6m 16m
AlphaBeta (2) 3k 10k
AlphaBeta (4) 100k 400k
AlphaBeta (6) 7m 20m
AlphaBeta pruning is significantly faster. In games where I want both algorithms to
produce moves at roughly the same pace AB can easily be set to a higher depth. AB also wins
more frequently than Minimax. Minimax is impractical to use in a realistic scenario. A running
example can be found in Appendix C.
5.2 Monte Carlo and UCT
Both algorithms are set to the same node limits. From my observations the opening
game play is random enough and neither algorithm has an advantage. There seem to be a
threshold node limit past which UCT will be winning more in the endgame. For a 9x9 board the
threshold appears to be 40k nodes per move past which UCT generally performs more
consistently and better than Monte Carlo. At lower node counts the outcome appears to be
very random and UCT may rely on a poorly tested move which appears to be winning a lot due
to not simulating enough games. By default the node limit is set to 50k which results in 1 move
11. ● Atari A group with only 1 liberty next to it.
● Suicide Playing a move which will make you automatically captured.
● Captured Group A group is captured by the opponent and removed from play if it has 0
liberties as a result of a move. Self capturing is suicide and not allowed.
● KO A ruling to prevent moves that will revert the board to its previous state.
● Territory An area surrounded by stones of 1 color.
● Eye A small territory. If a group has 2 eyes it can never be captured.
● Score Determined by adding stones on the board, captured stones and territory.
● Komi Bonus points given to white for playing second. Involves a 0.5 fraction to break
ties. Officially the komi on a 19x19 board is 6.5 points.
Appendix C Simulation examples
● Main Menu.