Skip to main content

Crate gfcore

Crate gfcore 

Source
Expand description

gfcore — Go Fish card game engine.

Built on cardpack v0.7 card primitives. Supports multiple Go Fish variants, bot AI players, and YAML/JSON game history.

§Quick Start

use gfcore::prelude::*;

// One human player, one bot backed by the basic heuristic strategy.
let players = vec![
    Player::new("Alice"),
    Player::new_bot("HAL", BotProfile::basic("HAL")),
];

let mut game = Game::new(GameVariant::Standard, players).unwrap();
assert!(!game.is_over());
assert_eq!(game.current_player(), 0);

// Inspect the initial state — always starts in WaitingForAsk.
let state = game.state().unwrap();
assert_eq!(state.phase, GamePhase::WaitingForAsk);
assert_eq!(state.players.len(), 2);
assert!(state.ask_log.is_empty());

§Features

FeatureDefaultEnables
historyhistory::GameRecord, YAML/JSON round-trips
wasm#[wasm_bindgen] exports for browser play

Modules§

bot
Bot AI module: strategies and profiles.
error
Error types for the gfcore Go Fish game engine.
game
Core game state machine.
history
Game history recording and YAML/JSON serialization.
player
Player types and hand management.
prelude
Convenient re-exports for common gfcore types.
rules
Go Fish rule variants and configuration.