Expand description
§ai-othello
An Othello rules and search library with bitboards and complete pass handling.
You can play against it compiled to Wasm here: https://thegustafson.com/games/othello
§Self-play
The selfplay binary runs deterministic paired-color matches. Each opening is
played twice with the engines swapping Black and White.
cargo run --release --bin selfplay -- \
--a maximum --b expert --games 12 --opening-plies 8 --seed 1The six built-in profiles are beginner, easy, medium, hard, expert,
and maximum. They progressively increase ordinary search depth and introduce
an empty-square threshold where the engine solves the rest of the game exactly.
Use the --a-* and --b-* options shown by selfplay --help to override them.
Library users can read the same settings with search_preset or
SEARCH_PRESETS.
§Use it
Add the crate to your project:
[dependencies]
ai-othello = "0.1"use ai_othello::{EvaluationProfile, Position, SearchConfig, search};
let position = Position::default();
let config = SearchConfig::fixed_depth(5, EvaluationProfile::Phase);
let result = search(position, config);
assert!(result.best_move.is_some());The crate includes reversible moves, perft, phase-aware evaluation, alpha-beta search, exact endgame search, and a Cassio protocol adapter.
cargo test
cargo run
cargo run -- --cassioLicensed under the MIT License.
Modules§
- verification
- Slow reference code used to verify the bitboard implementation.
Structs§
- Candidate
- Cassio
Engine - Line-oriented adapter for Cassio’s
ENGINE-PROTOCOL. - Engine
- One line-oriented engine session shared by the browser and native binary.
- Evaluation
- Traceable position evaluation from the current side’s perspective.
- Evaluation
Weights - Move
List - Fixed-capacity list large enough for every Othello move.
- Position
- Two disjoint bitboards and the side whose transition comes next.
- Score
- Search score with exact results kept outside the heuristic band.
- Search
Config - Search
Preset - A named search depth and exact-endgame threshold for interactive play.
- Search
Report - Complete result of one search.
- Search
Stats - Square
- One square, with
a1as the least-significant bit. - Undo
Enums§
- Evaluation
Profile - Cumulative evaluator stages used by the controlled browser experiment.
- Game
Result - Move
- Othello pass is a real move because it changes the side to move.
- Move
Error - Score
Kind - Side
Constants§
- SEARCH_
PRESETS - The built-in strength ladder, ordered from least to most search work.
Functions§
- evaluate
- Evaluates
positionfrom its side-to-move perspective. - perft
- Counts legal move sequences to exactly
depthplies with the bitboard core. - search
- Searches
positionto the configured depth. - search_
preset - Finds a built-in strength preset by its lowercase name.
- search_
until - Search a fixed depth while polling a cooperative stop signal at node entry. A stopped partial result is discarded.