Skip to content
Alpha-beta pruning minimax AI for Four in a Row. 2nd Year university assignment.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Join4
Screenshots
.gitignore
Join4.sln
README.md

README.md

Join4

An alpha-beta pruning minimaxing AI for Four in a Row




This project was created as part of a second year university assignment. This implementation utilises a heuristic minimax algorithm to generate the AI's move.

To achieve this, the game board is stored as two bit array; one for each player. Storing the board as a bit array allows faster computation of static evaluations allowing for faster generation of AI moves using bit manipulations. The bit array is mapped to the game board as shown below:

where the number represents the index of the tile within the bit array

Once a player makes a move, the AI generates a tree of all possible moves from the current state. An static evaluation function is applied to generate a score for any given state and is used as the value of each node in the tree. The depth of this tree is set to 2 (meaning the first layer represents a maximum played by the AI and the second is a minimum played by the player).

By performing a minmax on the tree (with AB pruning to speed up computation), a move for the AI can be generated.
You can’t perform that action at this time.