An AI browser-based game, where the goal is to be the last player with an available move.
What is it?
How to Play
At each turn, the player may choose to move any number of spaces up, right, down, left, or diagonally as long as the path is not blocked by a previously visited cell.
After the first player selects a cell to start, the second player may choose a starting cell. Players then take turns moving their player to a new cell, according to the rules above, until a player can no longer make a move - meaning that the player is effectively trapped. At this point, the opposing player wins.
One of the simplest implementations of the game is a 3x3 grid.
AI Opponent Using Minimax
The AI computer player uses the Minimax algorithm. This allows the AI to take the current game board state and build a tree of all possible moves and next states that each player may take. The Minimax algorithm is then applied from the bottom of the tree, upwards, in order to determine the best move to make for the current turn. The AI always assumes that the player will make an optimal move, and bases its decision accordingly.
Isolation implements a port of the Minimax with Alpha-beta pruning algorithm developed for Python.
Running the Game
Or run locally, with the following command.
cd isolation python -m SimpleHTTPServer 8000
Any http server may be used to host the game locally. An example of using the Python SimpleHTTPServer is shown above. Execute the above command from the directory containing the game. Then navigate to http://localhost:8000 to play the game.
How is it Made?
Edit the code on CodePen.
Kory Becker http://www.primaryobjects.com/kory-becker