Skip to main content

gametools/
lib.rs

1//! # gametools
2//!
3//! `gametools` provides utilities for working with common table game apparatus such as card decks,
4//! dice, spinners, and dominos. The goal is to provide flexible, modular tools to simplify prototyping and building
5//! games and simulations.
6//!
7//! ## Features
8//! - `cards`: generic card faces plus deck, hand, and pile abstractions, with standard 52-card and Uno helpers.
9//! - `dice`: `Die` and `Rolls` support for regular and exploding dice along with common roll-analysis helpers.
10//! - `ordering`: stable ranked lists (`RankedOrder`) and heap-backed queues (`PriorityQueue`) for turn order and scheduling.
11//! - `refilling_pool`: infinitely reusable random pools with conditional and contextual draw helpers.
12//! - `spinners`: decision wheels with weighted, coverable wedges that can hold arbitrary values.
13//! - `dominos`: domino set creation, train management, and longest-train solving.
14//! - `GameError`, `DiceError`, and `GameResult` for shared error handling across the crate.
15
16pub mod cards;
17pub use cards::{
18    AddCard, Card, CardCollection, CardFaces, CardHand, Deck, Hand, Pile, Rank, Suit, TakeCard,
19};
20
21pub mod dice;
22pub use dice::{Die, DieResult, Rolls};
23
24pub mod dominos;
25pub use dominos::{BonePile, Domino, DominoHand, MAX_PIPS, Train};
26
27pub mod refilling_pool;
28pub use refilling_pool::RefillingPool;
29
30pub mod spinners;
31pub use spinners::{Spinner, Wedge, wedges_from_tuples, wedges_from_values};
32
33pub mod gameerror;
34pub use gameerror::{DiceError, GameError};
35pub type GameResult<T> = Result<T, GameError>;
36
37pub mod ordering;
38pub use ordering::{
39    AscendingOrder, DescendingOrder, Max, MaxPriorityQ, Min, MinPriorityQ, PriorityQueue,
40    RankedOrder,
41};