piech
piech is a dependency-free Rust game engine for letting humans and humanoid
controllers play Daifugo (Japanese President) through the same interface.
use ;
let players = ;
let mut game = deal?;
let current = game.current_player_id.unwrap.to_owned;
let action = game.view_for?.legal_actions.clone;
game.apply?;
# Ok::
Game principles
- Human and humanoid seats use identical observations and actions.
- Each player sees only their hand, opponent card counts, and public state.
- Legal actions are generated by the engine, making agent integration direct.
- The
Agenttrait lets a humanoid, AI, or human UI take a validated turn from its privatePlayerView. - Values remain deterministic; callers provide the shuffled deck order.
- Singles and same-rank groups of up to four cards are supported.
- Jokers can act as configurable wildcards in groups.
- Four-card groups can toggle revolution.
- Eights can clear the trick and retain the lead.
- A lone three of spades can beat a lone joker.
- Players who pass stay out until the trick clears.
- The engine determines every finishing position, including the final player.
Rule scope
Daifugo rules vary widely. Version 0.1 intentionally does not implement straights, suit lock, eleven-back, five-skip, card exchange, or forbidden finishes. Applications should present the configured rule set to every player before play and must not assume unsupported local rules.
The crate performs no networking, random-number generation, robot motion, or model inference. It has no external dependencies and uses no unsafe code.
Licensed under MIT.