Skip to main content

Crate gametools

Crate gametools 

Source
Expand description

§gametools

gametools provides utilities for working with common table game apparatus such as card decks, dice, spinners, and dominos. The goal is to provide flexible, modular tools to simplify prototyping and building games and simulations.

§Features

  • cards: generic card faces plus deck, hand, and pile abstractions, with standard 52-card and Uno helpers.
  • dice: Die and Rolls support for regular and exploding dice along with common roll-analysis helpers.
  • ordering: stable ranked lists (RankedOrder) and heap-backed queues (PriorityQueue) for turn order and scheduling.
  • refilling_pool: infinitely reusable random pools with conditional and contextual draw helpers.
  • spinners: decision wheels with weighted, coverable wedges that can hold arbitrary values.
  • dominos: domino set creation, train management, and longest-train solving.
  • GameError, DiceError, and GameResult for shared error handling across the crate.

Re-exports§

pub use cards::AddCard;
pub use cards::Card;
pub use cards::CardCollection;
pub use cards::CardFaces;
pub use cards::CardHand;
pub use cards::Deck;
pub use cards::Hand;
pub use cards::Pile;
pub use cards::Rank;
pub use cards::Suit;
pub use cards::TakeCard;
pub use dice::Die;
pub use dice::DieResult;
pub use dice::Rolls;
pub use dominos::BonePile;
pub use dominos::Domino;
pub use dominos::DominoHand;
pub use dominos::MAX_PIPS;
pub use dominos::Train;
pub use refilling_pool::RefillingPool;
pub use spinners::Spinner;
pub use spinners::Wedge;
pub use spinners::wedges_from_tuples;
pub use spinners::wedges_from_values;
pub use gameerror::DiceError;
pub use gameerror::GameError;
pub use ordering::AscendingOrder;
pub use ordering::DescendingOrder;
pub use ordering::Max;
pub use ordering::MaxPriorityQ;
pub use ordering::Min;
pub use ordering::MinPriorityQ;
pub use ordering::PriorityQueue;
pub use ordering::RankedOrder;

Modules§

cards
Cards Toolkit
dice
Dice - types and manipulations commonly needed for die-based games
dominos
Dominos Module
gameerror
Shared error types used across the crate.
ordering
ordering - types for handling anything in a particular order.
refilling_pool
RefillingPool - a randomized pool of items that refills itself when empty.
spinners
Spinners Module

Type Aliases§

GameResult