Skip to main content

Crate gametools

Crate gametools 

Source
Expand description

§gametools

gametools provides reusable utilities for common game-building needs such as card decks, dice, spinners, dominos, grids, ranked ordering, and bounded resources. 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.
  • grid: point-addressed rectangular grids with row, column, and neighbor traversal helpers.
  • ordering: stable ranked lists (RankedOrder) and heap-backed queues (PriorityQueue) for turn order and scheduling.
  • metered_resource: bounded unsigned counters with saturating increase and reduction helpers.
  • 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.
  • Module-specific error enums plus GameError / GameResult for aggregate 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 metered_resource::MeteredResource;
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::CardError;
pub use gameerror::DiceError;
pub use gameerror::DominoError;
pub use gameerror::GameError;
pub use gameerror::GridError;
pub use gameerror::RefillingPoolError;
pub use gameerror::SpinnerError;
pub use gameerror::ValueError;
pub use grid::Grid;
pub use grid::GridSize;
pub use grid::Point;
pub use grid::PointDelta;
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.
grid
Grid<T>
metered_resource
MeteredResource
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

Macros§

ensure

Type Aliases§

GameResult