namespace HSchool.Simulation; /// /// The speed buttons the player can pick, as an index on the wire. The table is duplicated in /// src/HSchool.Client/src/net/protocol.ts — indexes, not multipliers, travel over the socket. /// public static class ClockSpeed { /// ×½, ×1, ×2, ×5, ×10. public static ReadOnlySpan Multipliers => [0.5d, 1d, 2d, 5d, 10d]; /// Index of ×1, the speed a school starts at. public const int DefaultIndex = 1; public static int Count => Multipliers.Length; public static bool IsValid(int index) => index >= 0 && index < Multipliers.Length; /// Multiplier for a validated index; out-of-range values fall back to ×1. public static double MultiplierAt(int index) => IsValid(index) ? Multipliers[index] : Multipliers[DefaultIndex]; /// /// Calendar impulses between heavy-system ticks. ×5 and ×10 stride so walking and needs keep /// one game minute per heavy step instead of twenty tiny ones per second. /// public static int HeavySystemsStride(int speedIndex) => speedIndex switch { 3 => 4, 4 => 2, _ => 1, }; /// /// Game minutes passed into presence, needs and learning on a heavy tick. High speeds use a /// fixed one-minute quantum; lower speeds pass the impulse's own advance. /// public static double HeavyGameMinutes(int speedIndex, double impulseMinutes) => speedIndex is 3 or 4 ? 1d : impulseMinutes; }