Overview
A Java implementation of my favorite board game, Othello (also known as Reversi), built to practice object-oriented design, data structures, and game-AI algorithms. Built in 2022, this is a pre-LLM project: every line was written and debugged by hand, before AI coding assistants existed.
What I did
- Player-vs-Player mode for two human players.
- Player-vs-Computer mode where the computer chooses its next move with a decision tree and the minimax algorithm, searching ahead to pick the best available play.
- Review Game mode, players step backward and forward through the whole game, implemented by storing each game state in a doubly linked list.
Approach and key decisions
Minimax for the opponent. Othello has a manageable branching factor and a clear board-score heuristic, which makes it a natural fit for minimax, the computer evaluates the tree of possible future board states and picks the move that maximizes its position assuming optimal play from the opponent.
A doubly linked list for review. Letting players scrub backward and forward through the match is cleanly modeled by a doubly linked list of game states: each node holds a full board, and stepping is just following prev/next pointers, a good example of choosing the data structure to fit the interaction.
Figures
Gameplay, player-vs-player or vs. the minimax AI.
Game over.
Review mode, step through every move via the stored game states.