REVERSIENGINE
A complete Reversi AI written in Rust. Two u64 bitboards hold the entire board state. Negamax with alpha-beta pruning and iterative deepening searches up to 11 plies deep with phase-aware evaluation.
01 — Under the Hood
Three layers of search intelligence.
Each technique compounds the last. Together they let the engine evaluate millions of positions across all supported depths in milliseconds.
Negamax + α-β Pruning
Negamax frames the search symmetrically — the score is always from the current player's perspective. Alpha-beta pruning cuts branches that can't affect the outcome, dramatically reducing the search tree without losing accuracy.
Iterative Deepening
Searches depth 1 through 7 repeatedly, using the best move from the previous depth as the first candidate at the next. This move ordering makes alpha-beta cuts more effective and gives a move to play under time pressure.
Transposition Table
A hash map keyed by the pair of black/white bitboards caches previously evaluated positions. When the same board state is reached via a different move order, the cached score is returned immediately.
02 — Architecture
The entire board
fits in 128 bits.
Two u64 integers — one for Black, one for White. Each bit maps to one of the 64 squares. A set bit means that player occupies that square.
Move generation uses directional bit shifts with edge masks to avoid wraparound. No loops over cells — just bitwise operations. The grids on the right update live as the animation cycles.
// board.rs
struct Board {
black: u64,
white: u64,
}
Black — u64
White — u64
03 — Evaluation
The AI thinks differently
at each phase.
A static evaluation function that doesn't adapt to game phase misleads the search. The engine shifts its priorities as the board fills.
0–20 discs
Early Game
Mobility
Maximise your moves, minimise opponent's
Corner Safety
Avoid squares adjacent to corners
Disc Count
Largely irrelevant this early
20–44 discs
Mid Game
Mobility
Maintain high move options
Corners
Corner squares worth far more
Stable Discs
Edge and corner discs that can't flip
44–64 discs
Late Game
Corners
Anchors for stable formations
Stability
Unflippable disc count dominates
Disc Count
Final score — now it matters
04 — Play It
The engine runs in your browser.
Same Rust engine compiled to a local HTTP server. Choose your side, set the search depth, and challenge the AI. The web UI shows legal moves and full move history.

Side selection
Play as Black or White
Depth control
Dial AI difficulty from 3-11
Legal move hints
Highlighted cells show valid placements
Move history
Full log of every move in the game
New game
Reset and replay anytime
