Phase 40: clock tempo at 1 min/s, x5/x10 heavy stride.

This commit is contained in:
Leonid Pershin
2026-08-20 07:02:24 +03:00
parent 2a55a025f4
commit 9199ea36d2
16 changed files with 192 additions and 57 deletions
+1 -1
View File
@@ -327,6 +327,6 @@ describe('decodeServerMessage', () => {
describe('clock speeds', () => {
it('matches the server table', () => {
expect([...CLOCK_SPEEDS]).toEqual([0.5, 1, 2, 3, 4]);
expect([...CLOCK_SPEEDS]).toEqual([0.5, 1, 2, 5, 10]);
});
});
+1 -1
View File
@@ -33,7 +33,7 @@ export const WireLocale = {
* Speed buttons, in wire order — the index travels, not the multiplier.
* Mirror of `ClockSpeed.Multipliers` in `src/HSchool.Simulation/ClockSpeed.cs`.
*/
export const CLOCK_SPEEDS = [0.5, 1, 2, 3, 4] as const;
export const CLOCK_SPEEDS = [0.5, 1, 2, 5, 10] as const;
export const DEFAULT_SPEED_INDEX = 1;
@@ -0,0 +1,25 @@
/**
* @vitest-environment happy-dom
*/
import { describe, expect, it, vi } from 'vitest';
import { GameScreen } from './gameScreen.ts';
describe('GameScreen speed buttons', () => {
it('shows five speed buttons ×½ ×1 ×2 ×5 ×10', () => {
const onSetSpeed = vi.fn();
const screen = new GameScreen({
onLeave: () => {},
onSetRunning: () => {},
onSetSpeed,
onSkip: () => {},
});
document.body.append(screen.element);
const labels = [...screen.element.querySelectorAll('.clock__controls .button--small')]
.map((button) => button.textContent ?? '')
.filter((text) => text.startsWith('×'));
expect(labels).toEqual(['×½', '×1', '×2', '×5', '×10']);
});
});
+1 -1
View File
@@ -24,7 +24,7 @@ interface GameScreenOptions {
readonly onSkip: () => void;
}
const SPEED_LABELS = ['×½', '×1', '×2', '×3', '×4'];
const SPEED_LABELS = ['×½', '×1', '×2', '×5', '×10'];
/**
* The inside of a school: calendar controls plus the manager shell. The tree comes from one map
+1 -1
View File
@@ -23,7 +23,7 @@ interface MainMenuOptions {
* timer — the server is the only thing that knows what time it is in each of them.
*
* One second is well below the resolution the cards show: at ×1 a game minute passes every
* 12 real seconds, at ×4 every 3.
* real second, at ×10 every tenth of a second on the clock (still one poll per second here).
*/
const REFRESH_INTERVAL_MS = 1000;