Othello
← Back to Overview

Othello (Reversi)

The classic strategy game with advanced AI

🎯 About This Game

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.

📖 Rules of Othello

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.

🎮 How to Play

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.

⚙️ Technical Details

The game is built entirely in Rust using the Macroquad framework and compiled to WebAssembly. The AI uses advanced search algorithms:

  • Negamax Algorithm: A variant of the minimax algorithm for two-player zero-sum games
  • Alpha-Beta Pruning: Optimizes search by eliminating branches that cannot affect the outcome
  • Move Ordering: Prioritizes promising moves for more efficient search

💡 Strategy Tips

  • Capture Corners: Corner positions can never be flipped - they're the most valuable positions
  • Edge Control: Edges provide more stability than central positions
  • Mobility Advantage: Try to maintain more move options than your opponent
  • Early Restraint: It's often not advantageous to have many discs early in the game
  • Avoid X-Squares: The squares diagonally adjacent to corners (X-squares) should be avoided as they give your opponent access to corners