Expand description
Four in a row for the terminal.
The crate is split into three independent layers:
gameis pure library code. It owns the rules and knows nothing about how a game is displayed or who is playing it.botturns agame::GameStateinto a move. Every bot is a small, self-contained strategy.appis the terminal front end. It is the only layer that depends onratatui, so it can be replaced by a desktop or web front end without touching the layers below.
§Examples
use fours::game::Game;
use fours::game::Player;
let mut game = Game::new();
for column in [3, 0, 3, 1, 3, 2, 3] {
game.play(column).unwrap();
}
assert_eq!(game.state().winner(), Some(Player::Red));