This project implements the classic Othello (Reversi) game with a sophisticated AI opponent. The AI uses a negamax algorithm enhanced with alpha-beta pruning and move ordering to play at a strong level.
Othello (also known as Reversi) is a two-player strategy game played on an 8×8 board with discs that are black on one side and white on the other.
Setup: The game begins with four discs placed in the center of the board in a square pattern: two white discs and two black discs arranged diagonally.
Gameplay: Players take turns placing discs on the board with their color facing up. Black typically moves first. A legal move must flank at least one opponent's disc between the newly placed disc and another disc of the player's color (horizontally, vertically, or diagonally). All flanked opponent discs are then flipped to the current player's color.
Passing: If a player has no legal moves available, they must pass their turn. If both players have no legal moves, the game ends.
Winning: The game ends when the board is full or neither player can make a legal move. The player with the most discs of their color on the board wins. Ties are possible.
Key Strategy: Corner positions are highly valuable as they cannot be flipped. Players aim to control the board while limiting their opponent's options.
Starting the Game: At the beginning, you'll be presented with a choice screen where you select your color and, therefore, whether you want to start the game.
Making Moves: During the game, you can already see the crosses on the board to see which options are available to you. You place a disc by clicking on the field.
Passing: If you have to pass, the computer automatically continues. If the computer passes, you can continue with your next move.
Game End: When the game ends, the winner is shown at the top of the screen. By simply clicking on it, you can restart with the color selection process.
The game is built entirely in Rust using the Macroquad framework and compiled to WebAssembly. The AI uses advanced search algorithms: