Skip to main content

Module game

Module game 

Source
Expand description

Core game state machine.

This module provides the Game engine, the GamePhase enum, the GameState snapshot type, and the GameEvent enum that describes the outcome of every player action.

For player moves see action::PlayerAction.

§Quick example

use gfcore::prelude::{Game, GamePhase, GameVariant, Player};

let players = vec![Player::new("Alice"), Player::new("Bob")];
let game = Game::new(GameVariant::Standard, players).unwrap();
assert_eq!(*game.phase(), GamePhase::WaitingForAsk);
assert_eq!(game.current_player(), 0);
assert!(!game.is_over());

Re-exports§

pub use action::PlayerAction;

Modules§

action
Player actions that drive the Go Fish state machine.

Structs§

Game
The Go Fish game engine.
GameState
A serialisable snapshot of the game for callers, bots, and wire protocols.

Enums§

GameEvent
An event emitted by the game engine as a result of a player action.
GamePhase
The current phase of the Go Fish state machine.