Skip to main content

shuyi_core/
lib.rs

1//! Shuyi Engine's core: the seeded RNG, timers in steps or turns
2//! ([`timer`]), ease curves and tweens drawn from the time alone, in
3//! integers ([`ease`]: [`Ease`], [`Tween`], [`Lerp`]), the simulation traits (turns, [`TurnRules`], and fixed
4//! steps in time, [`tick`]: [`TickSim`], its input, its records and their
5//! [`replay`](tick::replay)), a toy one for the engine's tests (`toy`, with
6//! the `toy` feature) and the tactics kit (a square grid, paths over it, the tiles each piece can
7//! strike and the danger at a tile ([`threat`]), turns and their history,
8//! and bots that play a game to its end, among them a rollout bot that
9//! plans on copies of the game: [`Determinize`], [`Evaluate`], [`Order`],
10//! [`Unordered`], [`Playout`], [`Rollout`], [`RolloutSettings`],
11//! [`RolloutSearch`] and [`Horizon`], a turn planner that plans its
12//! side's whole turn on them: [`TurnPlan`], [`PlanSettings`] and
13//! [`PlanSearch`], the few candidates such a bot tries first, in ranked
14//! groups ([`ranked_order`], [`Ranked`]) and for grid games
15//! ([`TacticsOrder`], [`OrderHooks`]), a playtest runner that checks how often each of
16//! several bots succeeds, [`bots::playtest`], and an autobalance search
17//! whose [`Knob`]s change a stage until each lands in its band:
18//! [`autobalance`], [`autobalance_by`], [`BalanceSettings`], [`Balanced`]
19//! and [`Stop`]), a hash of a state that replays compare, the stamp of
20//! what made a record or a save ([`made`]), the version every [`save`]
21//! names, and what text and stories need below the assets:
22//! character ids and the `{token}` splitter.
23//!
24//! Pure and deterministic: no I/O, no clock, no platform. A game's rules
25//! crate sits on it and keeps its own rules, turn loop and data (game ADR-0063
26//! §2, §6).
27#![cfg_attr(not(feature = "std"), no_std)]
28#![forbid(unsafe_code)]
29// No floats in a simulation (ADR-0002 §2, ADR-0032); tests may use them.
30#![cfg_attr(not(test), deny(clippy::float_arithmetic))]
31
32extern crate alloc;
33
34pub mod bots;
35pub mod character;
36pub mod ease;
37pub mod grid;
38pub mod hash;
39pub mod history;
40pub mod made;
41pub mod path;
42pub mod rng;
43pub mod save;
44pub mod text;
45pub mod threat;
46pub mod tick;
47pub mod timer;
48#[cfg(any(test, feature = "toy"))]
49pub mod toy;
50pub mod turn;
51
52pub use bots::{
53    BalanceSettings, Balanced, Bot, Determinize, Evaluate, Horizon, Knob, Order, PlanSearch,
54    PlanSettings, PlayError, Playout, RandomBot, Ranked, Report, Rollout, RolloutSearch,
55    RolloutSettings, Sides, Stop, TurnPlan, Unordered, autobalance, autobalance_by, play,
56    play_observed, ranked_order,
57};
58pub use character::CharacterId;
59pub use ease::{Ease, Easing, Family, Lerp, Tween};
60pub use grid::{Dir, Grid, GridSizeError, Pos, TerrainId, TileSet};
61pub use hash::{HashError, StateHash, state_hash};
62pub use history::{History, NoSuchPoint, Replayed};
63pub use made::{ContentHash, Made};
64pub use path::{Reach, flow_field, reachable};
65pub use rng::{RandomSource, ScriptedRng, SimRng};
66pub use save::{SaveFormat, SaveHeader};
67pub use text::{Part, split_tokens};
68pub use threat::{
69    Danger, GoalDistance, OrderHooks, Ranges, Strike, TacticsOrder, Threat, Threats, strike_area,
70    strike_area_from,
71};
72pub use tick::{ActionId, SeatInput, TickInput, TickRecord, TickSim};
73pub use timer::{Countdown, Every, STEPS_PER_SECOND, ms_from_steps, steps_from_ms};
74pub use turn::TurnRules;