Magpie is a high-performance Othello library built with bitboards and zero dependencies.
Magpie offers two abstraction levels:
- Game API: rule-checked, turn-aware game logic and state management. Enforces legal moves and tracks turns.
- Board API: lower-level, unchecked board operations for maximum performance. Useful when building engines.
use magpie::othello::{Game, Status, Stone};
let mut game = Game::new();
// Black moves first in Othello
assert_eq!(game.current_turn(), Stone::Black);
// Pick the first available move and play it
let pos = game.moves().hot_bits().next().unwrap();
game.play(pos)?;
println!("{}", game.display());
assert_eq!(game.current_turn(), Stone::White);
assert_eq!(game.status(), Status::Progressing);cargo add magpie
# Serde support is available through the serde feature flag.
cargo add magpie -F serdeExamples are described here.
Curious to play? One example features a functional Othello game with a random AI opponent. Run cargo run --example human_vs_ai to start a game!
Benchmarks are described here
Run the benchmarks with cargo bench.