Crates.io | gametools |
lib.rs | gametools |
version | |
source | src |
created_at | 2025-04-06 06:51:06.911555+00 |
updated_at | 2025-04-14 01:57:54.844252+00 |
description | Game-related tools: spinners, dice, dominos, and cards. |
homepage | |
repository | https://github.com/pygmy-twylyte/gametools |
max_upload_size | |
id | 1622677 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
gametools is a lightweight Rust library for simulating game components like dice rolls, card decks, dominos, and spinners. It's designed to be modular, testable, and usable in both game engines and CLI tools. The goal is to provide reusable game apparatus โ not game logic โ so you can build your rules on top of well-tested building blocks.
use gametools::{Die, DicePool};
let d6 = Die::new(6);
let total = d6.roll_into_pool(5)
.take_highest(4)
.nerf(1)
.sum();
use gametools::spinners::{Spinner, wedges_from_values};
let wedges = wedges_from_values(vec!["Rock", "Paper", "Scissors"]);
let spinner = Spinner::new(wedges);
if let Some(result) = spinner.spin() {
println!("You chose: {result}");
}
This crate avoids hardcoding game rules. Instead, it provides flexible, composable abstractions to make building games easier โ whether you're making a tabletop simulator, card game engine, or randomizer tool.
Full API docs with usage examples are available via docs.rs.
See additional usage examples in the module docs:
Licensed under MIT. Contributions welcome!