Expand description
§go-fish
go-fish is a library providing core engine functionality for the classic Go Fish card game.
It provides types for cards, decks, and players, and manages the game logic including turns, drawing, and completing books.
§Example
use go_fish::{Game, Deck, Hook, PlayerId, Rank};
// Initialize a new game with 3 players
let deck = Deck::new().shuffle();
let mut game = Game::new(deck, 3);
// Current player takes a turn
let hook = Hook {
target: PlayerId::new(1),
rank: Rank::Ace,
};
match game.take_turn(hook) {
Ok(result) => println!("Turn result: {:?}", result),
Err(e) => eprintln!("Error: {:?}", e),
}Structs§
- Card
- A playing card
- Complete
Book - A collection of four Cards of the same Rank
- Deck
- A deck of Cards
- Game
- Handling for a game of Go Fish
- Game
Result - Hand
- A players hand
- Hook
- A request for another players cards
- Hook
Outcome - The full outcome of a take_turn call, including who fished, who was targeted, what rank was requested, and whether the catch succeeded.
- Inactive
Player - A player who no longer has any viable moves. They can still win the game, if they have more Completed Books than any other player at the end of the game
- Incomplete
Book - A collection of three or fewer Cards of the same Rank
- Player
- A player actively trying to win the game
- Player
Id