Skip to main content

Crate piech

Crate piech 

Source
Expand description

A deterministic, hidden-information Daifugo engine for humans and humanoids.

piech gives every controller the same observation/action interface. A PlayerView exposes the requesting player’s hand, public pile state, opponent hand counts, and legal actions—never opponents’ cards.

Version 0.1 models singles and same-rank groups, optional joker wildcards, revolution, eight-cut, and spade-three-over-joker. Daifugo has many regional rules; unsupported rules such as straights and suit lock are intentionally not inferred.

§Example

use piech::{Action, Controller, Game, Player, Rules};

let players = [
    Player::new("us", Controller::Human)?,
    Player::new("robot", Controller::Humanoid)?,
];
let mut game = Game::deal(players, piech::standard_deck(1)?, Rules::default())?;
let current = game.current_player_id().unwrap().to_owned();
let action = game.view_for(&current)?.legal_actions()[0].clone();
game.apply(&current, action)?;

Structs§

Game
Deterministic Daifugo game state.
Meld
An analyzed single or same-rank group.
OpponentView
Public information about another seat.
Player
A public player seat definition.
PlayerView
Information legally visible to one player controller.
Rules
Configurable rules supported by this engine version.

Enums§

Action
A controller action.
Card
A unique suited card or numbered joker.
Controller
Who controls a player seat.
Error
Game setup, action, and rule errors.
GamePhase
Public phase of the game.
Rank
Daifugo rank order before revolution: 3 is lowest and 2 is highest.
StepError
Failure while asking an Agent to take one turn.
Suit
A standard French-suited card suit.

Traits§

Agent
A human UI, humanoid controller, or software agent that chooses one action from a hidden-information player view.

Functions§

standard_deck
Builds an ordered 52-card deck followed by joker_count unique jokers.