@maco-online/shuttle-blitz-rules 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,430 @@
1
+ // Match and training session: fixed-step simulation driven by input, emitting SimEvents (mockup match.js:77-110, 813-890).
2
+ import { makeActor, swingWithAssist, tryJump, updateActor } from "./actor.js";
3
+ import { aiUpdate, makeOpponent } from "./ai.js";
4
+ import { BANNER_KEYS, POP_KEYS } from "./events.js";
5
+ import { trackPose } from "./pose-state.js";
6
+ import { afterPoint, buildResult, gamesNeeded, keepInServiceCourt, land, nextGame, placeHeldShuttle, setupServe } from "./rules.js";
7
+ import { airShotPower, pop, releaseCharge } from "./shots.js";
8
+ import { createSlowMo, shouldTrigger, startSlowmo } from "./slowmo.js";
9
+ import { feed, finishTraining, makeTrainState } from "./training.js";
10
+ import { AIR_CONTACT_ASSIST, DIFF, FLOOR, G, INPUT_BUFFER, NET_TOP, NET_X } from "./world.js";
11
+ const isShotAction = (a) => a === 'clear' || a === 'drop' || a === 'smash';
12
+ const TRAINING_IDS = ['feeder', 'target', 'smash'];
13
+ function assertStats(label, st) {
14
+ if (!st || ![st.spd, st.pow, st.sta, st.tec].every((v) => Number.isFinite(v))) {
15
+ throw new TypeError(`createMatch: ${label} stats must be four finite numbers`);
16
+ }
17
+ }
18
+ function assertConfig(cfg) {
19
+ if (cfg.mode !== 'match' && cfg.mode !== 'training')
20
+ throw new TypeError(`createMatch: unknown mode ${String(cfg.mode)}`);
21
+ assertStats('player', cfg.player);
22
+ if (cfg.mode === 'training') {
23
+ if (!cfg.trainingId || !TRAINING_IDS.includes(cfg.trainingId)) {
24
+ throw new TypeError(`createMatch: unknown trainingId ${String(cfg.trainingId)}`);
25
+ }
26
+ return;
27
+ }
28
+ assertStats('opponent', cfg.opponent?.stats);
29
+ if (!Number.isFinite(cfg.opponent.aggr))
30
+ throw new TypeError('createMatch: opponent aggr must be finite');
31
+ if (!(cfg.difficulty in DIFF))
32
+ throw new TypeError(`createMatch: unknown difficulty ${String(cfg.difficulty)}`);
33
+ if (!Number.isInteger(cfg.tier) || cfg.tier < 1)
34
+ throw new TypeError(`createMatch: tier must be an integer >= 1`);
35
+ if (!Number.isInteger(cfg.bestOf) || cfg.bestOf < 1 || cfg.bestOf % 2 === 0) {
36
+ throw new TypeError(`createMatch: bestOf must be a positive odd integer, got ${cfg.bestOf}`);
37
+ }
38
+ }
39
+ function makeShuttle() {
40
+ return { x: 0, y: 0, vx: 0, vy: 0, live: false, heldBy: null, lastHitter: null, netted: false, kind: 'clear', cross: false, kmh: 0 };
41
+ }
42
+ /** Moves the shuttle: carried by the server, or in flight with net collision and floor landing. */
43
+ export function updateShuttle(ctx, dt) {
44
+ const { s } = ctx;
45
+ const sh = s.shuttle;
46
+ if (sh.heldBy) {
47
+ placeHeldShuttle(s);
48
+ return;
49
+ }
50
+ if (!sh.live)
51
+ return;
52
+ const px = sh.x;
53
+ const py = sh.y;
54
+ sh.vy += G * dt;
55
+ sh.x += sh.vx * dt;
56
+ sh.y += sh.vy * dt;
57
+ if (!sh.netted && (px - NET_X) * (sh.x - NET_X) < 0) {
58
+ const k = (NET_X - px) / (sh.x - px);
59
+ const yc = py + (sh.y - py) * k;
60
+ if (yc > NET_TOP) {
61
+ sh.netted = true;
62
+ sh.x = NET_X - Math.sign(sh.vx) * 12;
63
+ sh.vx = -sh.vx * 0.08;
64
+ sh.vy = Math.min(sh.vy * 0.2, 60);
65
+ ctx.out.push({ type: 'net', x: NET_X, y: yc });
66
+ pop(ctx, POP_KEYS.net, NET_X, NET_TOP - 80, 'small');
67
+ }
68
+ }
69
+ if (sh.y >= FLOOR - 6 && sh.vy > 0)
70
+ land(ctx);
71
+ }
72
+ export function createMatch(cfg, rng) {
73
+ assertConfig(cfg);
74
+ const training = cfg.mode === 'training';
75
+ const p = makeActor('p', { ...cfg.player });
76
+ const ai = training ? null : makeOpponent({ stats: { ...cfg.opponent.stats }, aggr: cfg.opponent.aggr }, cfg.difficulty, cfg.tier, cfg.boss);
77
+ if (cfg.serveHand?.p)
78
+ p.serveHand = cfg.serveHand.p;
79
+ if (ai && cfg.serveHand?.ai)
80
+ ai.serveHand = cfg.serveHand.ai;
81
+ if (ai?.brain && cfg.teachSmashes)
82
+ ai.brain.teach = cfg.teachSmashes;
83
+ const bestOf = training ? 1 : cfg.bestOf;
84
+ const s = {
85
+ mode: training ? 'training' : 'match',
86
+ p,
87
+ ai,
88
+ shuttle: makeShuttle(),
89
+ phase: 'serve',
90
+ timer: 0,
91
+ time: 0,
92
+ timeScale: 1,
93
+ slowmoUsed: false,
94
+ score: { p: 0, ai: 0 },
95
+ games: { p: 0, ai: 0 },
96
+ gameNo: 1,
97
+ gameScores: [],
98
+ bestOf,
99
+ need: gamesNeeded(bestOf),
100
+ server: 'p',
101
+ rally: 0,
102
+ stats: { smashes: 0, shots: 0, errors: 0, longest: 0 },
103
+ train: training && cfg.trainingId ? makeTrainState(cfg.trainingId) : null,
104
+ };
105
+ const slow = createSlowMo();
106
+ const ctx = { s, rng, out: [], slow };
107
+ if (s.train) {
108
+ s.phase = 'feed';
109
+ ctx.out.push({
110
+ type: 'banner',
111
+ key: BANNER_KEYS.training,
112
+ sub: BANNER_KEYS.trainingRule[s.train.kind],
113
+ vars: {},
114
+ side: 'p',
115
+ duration: 1.6,
116
+ });
117
+ }
118
+ else {
119
+ setupServe(ctx);
120
+ }
121
+ /** Events not yet handed out: the opening banner, or anything queued between steps. */
122
+ const drain = () => {
123
+ const out = ctx.out;
124
+ ctx.out = [];
125
+ return out;
126
+ };
127
+ /** A shot key pressed while the player was still swinging: kept INPUT_BUFFER seconds for when the swing ends. */
128
+ let buffered = null;
129
+ /** Starts a shot from a key press: at once in the air (no charge needed), else a charge released later. */
130
+ function beginShot(type, heldFor, stillHeld, crossNow) {
131
+ if (!p.onGround) {
132
+ swingWithAssist(ctx, p, type, airShotPower(p), { cross: crossNow }, AIR_CONTACT_ASSIST);
133
+ return;
134
+ }
135
+ p.charge = { type, t: heldFor, cross: crossNow };
136
+ if (!stillHeld)
137
+ releaseCharge(ctx, p, new Set(crossNow ? ['cross'] : []));
138
+ }
139
+ function applyInput(input, dt) {
140
+ const crossNow = input.held.has('cross') || input.pressed.includes('cross');
141
+ // A jump pressed in the same frame as a shot key goes first, so pressing both together always gives an air shot.
142
+ const pressed = input.pressed.includes('jump') ? ['jump', ...input.pressed.filter((a) => a !== 'jump')] : input.pressed;
143
+ for (const act of pressed) {
144
+ if (s.phase === 'ending' || s.phase === 'done')
145
+ break;
146
+ // A server holding the shuttle stays on the ground until the serve is struck.
147
+ if (act === 'jump' && s.shuttle.heldBy !== 'p')
148
+ tryJump(ctx.out, p);
149
+ if (!isShotAction(act) || p.charge)
150
+ continue;
151
+ if (!p.swing && !p.pending)
152
+ beginShot(act, 0, true, crossNow);
153
+ // A press during a held-back swing is dropped: that swing starts at once anyway and lasts longer than the buffer.
154
+ else if (p.swing && s.shuttle.heldBy !== 'p')
155
+ buffered = { type: act, age: 0, held: true, cross: crossNow };
156
+ }
157
+ if (crossNow) {
158
+ if (p.charge)
159
+ p.charge.cross = true;
160
+ if (p.pending)
161
+ p.pending.cross = true;
162
+ if (buffered)
163
+ buffered.cross = true;
164
+ }
165
+ for (const act of input.released) {
166
+ if (p.charge && p.charge.type === act)
167
+ releaseCharge(ctx, p, input.held);
168
+ if (buffered && buffered.type === act)
169
+ buffered.held = false;
170
+ }
171
+ if (buffered) {
172
+ if (s.phase === 'ending' || s.phase === 'done' || buffered.age > INPUT_BUFFER)
173
+ buffered = null;
174
+ else if (!p.swing && !p.pending && !p.charge) {
175
+ const b = buffered;
176
+ buffered = null;
177
+ beginShot(b.type, b.age, b.held, b.cross);
178
+ }
179
+ else
180
+ buffered.age += dt;
181
+ }
182
+ }
183
+ function finish() {
184
+ s.phase = 'done';
185
+ if (s.mode === 'training') {
186
+ ctx.out.push({ type: 'trainingEnd', result: finishTraining(s) });
187
+ }
188
+ else {
189
+ ctx.out.push({ type: 'matchEnd', result: buildResult(s, s.games.p > s.games.ai, false) });
190
+ }
191
+ }
192
+ function step(dt, input) {
193
+ if (!(dt > 0) || !Number.isFinite(dt))
194
+ throw new RangeError(`Match.step: dt must be a positive finite number, got ${dt}`);
195
+ if (s.phase === 'done')
196
+ return drain();
197
+ const realDt = dt / s.timeScale;
198
+ const slowedStep = slow.active;
199
+ applyInput(input, dt);
200
+ s.time += dt;
201
+ let dir = 0;
202
+ if (s.phase !== 'ending') {
203
+ if (input.held.has('left'))
204
+ dir -= 1;
205
+ if (input.held.has('right'))
206
+ dir += 1;
207
+ }
208
+ updateActor(ctx, p, dt, dir);
209
+ if (ai)
210
+ aiUpdate(ctx, ai, dt);
211
+ if (s.mode === 'match' && s.phase === 'serve')
212
+ for (const a of ai ? [p, ai] : [p])
213
+ keepInServiceCourt(a);
214
+ updateShuttle(ctx, dt);
215
+ if (shouldTrigger(s))
216
+ startSlowmo(ctx);
217
+ if (s.phase === 'point') {
218
+ if ((s.timer -= dt) <= 0)
219
+ afterPoint(ctx);
220
+ }
221
+ else if (s.phase === 'between') {
222
+ if ((s.timer -= dt) <= 0)
223
+ nextGame(ctx);
224
+ }
225
+ else if (s.phase === 'ending') {
226
+ if ((s.timer -= realDt) <= 0)
227
+ finish();
228
+ }
229
+ else if (s.phase === 'feed' && s.train) {
230
+ if ((s.train.timer -= dt) <= 0)
231
+ feed(ctx);
232
+ }
233
+ for (const a of ai ? [p, ai] : [p]) {
234
+ a.holding = s.shuttle.heldBy === a.side;
235
+ trackPose(a, dt);
236
+ }
237
+ if (slowedStep) {
238
+ slow.tick(realDt);
239
+ if (!slow.active)
240
+ ctx.out.push({ type: 'slowmo', factor: 1, duration: 0 });
241
+ }
242
+ s.timeScale = slow.factor;
243
+ return drain();
244
+ }
245
+ function forfeit() {
246
+ if (s.phase === 'done')
247
+ return drain();
248
+ s.phase = 'done';
249
+ if (s.mode === 'training')
250
+ ctx.out.push({ type: 'trainingEnd', result: { training: true, aborted: true } });
251
+ else
252
+ ctx.out.push({ type: 'matchEnd', result: buildResult(s, false, true) });
253
+ return drain();
254
+ }
255
+ return {
256
+ state: s,
257
+ step,
258
+ forfeit,
259
+ cancelCharge: () => {
260
+ p.charge = null;
261
+ p.pending = null;
262
+ buffered = null;
263
+ },
264
+ };
265
+ }
266
+ /**
267
+ * The deterministic two-player counterpart to `createMatch`. It deliberately shares the same court, scoring and
268
+ * shot code as the solo game; the only difference is that both actors receive a browser's input instead of asking
269
+ * `aiUpdate` to choose one. The RTC room host owns this simulation and sends snapshots to both browsers.
270
+ */
271
+ export function createPvpMatch(rng, bestOf = 3) {
272
+ if (!Number.isInteger(bestOf) || bestOf < 1 || bestOf % 2 === 0) {
273
+ throw new TypeError(`createPvpMatch: bestOf must be a positive odd integer, got ${bestOf}`);
274
+ }
275
+ const p = makeActor('p', { spd: 5, pow: 5, sta: 5, tec: 5 });
276
+ const ai = makeActor('ai', { spd: 5, pow: 5, sta: 5, tec: 5 });
277
+ const s = {
278
+ mode: 'match',
279
+ p,
280
+ ai,
281
+ shuttle: makeShuttle(),
282
+ phase: 'serve',
283
+ timer: 0,
284
+ time: 0,
285
+ timeScale: 1,
286
+ slowmoUsed: false,
287
+ score: { p: 0, ai: 0 },
288
+ games: { p: 0, ai: 0 },
289
+ gameNo: 1,
290
+ gameScores: [],
291
+ bestOf,
292
+ need: gamesNeeded(bestOf),
293
+ server: 'p',
294
+ rally: 0,
295
+ stats: { smashes: 0, shots: 0, errors: 0, longest: 0 },
296
+ train: null,
297
+ };
298
+ const slow = createSlowMo();
299
+ const ctx = { s, rng, out: [], slow };
300
+ setupServe(ctx);
301
+ const drain = () => {
302
+ const out = ctx.out;
303
+ ctx.out = [];
304
+ return out;
305
+ };
306
+ let bufferedP = null;
307
+ let bufferedAi = null;
308
+ const applyInput = (actor, input, dt, buffered, setBuffered) => {
309
+ const crossNow = input.held.has('cross') || input.pressed.includes('cross');
310
+ const pressed = input.pressed.includes('jump') ? ['jump', ...input.pressed.filter((a) => a !== 'jump')] : input.pressed;
311
+ for (const act of pressed) {
312
+ if (s.phase === 'ending' || s.phase === 'done')
313
+ break;
314
+ if (act === 'jump' && s.shuttle.heldBy !== actor.side)
315
+ tryJump(ctx.out, actor);
316
+ if (!isShotAction(act) || actor.charge)
317
+ continue;
318
+ if (!actor.swing && !actor.pending) {
319
+ if (!actor.onGround)
320
+ swingWithAssist(ctx, actor, act, airShotPower(actor), { cross: crossNow }, AIR_CONTACT_ASSIST);
321
+ else {
322
+ actor.charge = { type: act, t: 0, cross: crossNow };
323
+ if (!input.held.has(act))
324
+ releaseCharge(ctx, actor, new Set(crossNow ? ['cross'] : []));
325
+ }
326
+ }
327
+ else if (actor.swing && s.shuttle.heldBy !== actor.side) {
328
+ setBuffered({ type: act, age: 0, held: true, cross: crossNow });
329
+ buffered = { type: act, age: 0, held: true, cross: crossNow };
330
+ }
331
+ }
332
+ if (crossNow) {
333
+ if (actor.charge)
334
+ actor.charge.cross = true;
335
+ if (actor.pending)
336
+ actor.pending.cross = true;
337
+ if (buffered)
338
+ buffered.cross = true;
339
+ }
340
+ for (const act of input.released) {
341
+ if (actor.charge && actor.charge.type === act)
342
+ releaseCharge(ctx, actor, input.held);
343
+ if (buffered && buffered.type === act)
344
+ buffered.held = false;
345
+ }
346
+ if (buffered) {
347
+ if (s.phase === 'ending' || s.phase === 'done' || buffered.age > INPUT_BUFFER)
348
+ buffered = null;
349
+ else if (!actor.swing && !actor.pending && !actor.charge) {
350
+ const next = buffered;
351
+ buffered = null;
352
+ if (!actor.onGround)
353
+ swingWithAssist(ctx, actor, next.type, airShotPower(actor), { cross: next.cross }, AIR_CONTACT_ASSIST);
354
+ else
355
+ actor.charge = { type: next.type, t: next.age, cross: next.cross };
356
+ }
357
+ else
358
+ buffered.age += dt;
359
+ }
360
+ setBuffered(buffered);
361
+ };
362
+ function finish() {
363
+ s.phase = 'done';
364
+ ctx.out.push({ type: 'matchEnd', result: buildResult(s, s.games.p > s.games.ai, false) });
365
+ }
366
+ function step(dt, inputs) {
367
+ if (!(dt > 0) || !Number.isFinite(dt))
368
+ throw new RangeError(`Match.step: dt must be a positive finite number, got ${dt}`);
369
+ if (s.phase === 'done')
370
+ return drain();
371
+ const realDt = dt / s.timeScale;
372
+ const slowedStep = slow.active;
373
+ applyInput(p, inputs.p, dt, bufferedP, next => { bufferedP = next; });
374
+ applyInput(ai, inputs.ai, dt, bufferedAi, next => { bufferedAi = next; });
375
+ s.time += dt;
376
+ const pDir = s.phase === 'ending' ? 0 : (inputs.p.held.has('left') ? -1 : 0) + (inputs.p.held.has('right') ? 1 : 0);
377
+ const aiDir = s.phase === 'ending' ? 0 : (inputs.ai.held.has('left') ? -1 : 0) + (inputs.ai.held.has('right') ? 1 : 0);
378
+ updateActor(ctx, p, dt, Math.max(-1, Math.min(1, pDir)));
379
+ updateActor(ctx, ai, dt, Math.max(-1, Math.min(1, aiDir)));
380
+ if (s.phase === 'serve') {
381
+ keepInServiceCourt(p);
382
+ keepInServiceCourt(ai);
383
+ }
384
+ updateShuttle(ctx, dt);
385
+ if (shouldTrigger(s))
386
+ startSlowmo(ctx);
387
+ if (s.phase === 'point') {
388
+ if ((s.timer -= dt) <= 0)
389
+ afterPoint(ctx);
390
+ }
391
+ else if (s.phase === 'between') {
392
+ if ((s.timer -= dt) <= 0)
393
+ nextGame(ctx);
394
+ }
395
+ else if (s.phase === 'ending') {
396
+ if ((s.timer -= realDt) <= 0)
397
+ finish();
398
+ }
399
+ for (const actor of [p, ai]) {
400
+ actor.holding = s.shuttle.heldBy === actor.side;
401
+ trackPose(actor, dt);
402
+ }
403
+ if (slowedStep) {
404
+ slow.tick(realDt);
405
+ if (!slow.active)
406
+ ctx.out.push({ type: 'slowmo', factor: 1, duration: 0 });
407
+ }
408
+ s.timeScale = slow.factor;
409
+ return drain();
410
+ }
411
+ return {
412
+ state: s,
413
+ forfeit: () => {
414
+ if (s.phase !== 'done') {
415
+ s.phase = 'done';
416
+ ctx.out.push({ type: 'matchEnd', result: buildResult(s, false, true) });
417
+ }
418
+ return drain();
419
+ },
420
+ cancelCharge: () => {
421
+ for (const actor of [p, ai]) {
422
+ actor.charge = null;
423
+ actor.pending = null;
424
+ }
425
+ bufferedP = null;
426
+ bufferedAi = null;
427
+ },
428
+ stepPvp: step,
429
+ };
430
+ }
@@ -0,0 +1,6 @@
1
+ import type { Actor } from './state.ts';
2
+ export type AnimKey = 'idle' | 'run' | 'jump' | 'serve' | 'clear' | 'drop' | 'smash' | 'tired' | 'celebrate' | 'sad';
3
+ export declare const ANIM_KEYS: readonly AnimKey[];
4
+ export declare function actorPose(a: Actor): AnimKey;
5
+ /** Refreshes `pose` and `stateT` after a step: stateT restarts at 0 on every pose change. */
6
+ export declare function trackPose(a: Actor, dt: number): void;
@@ -0,0 +1,39 @@
1
+ import { TIRED_AT } from "./world.js";
2
+ export const ANIM_KEYS = [
3
+ 'idle',
4
+ 'run',
5
+ 'jump',
6
+ 'serve',
7
+ 'clear',
8
+ 'drop',
9
+ 'smash',
10
+ 'tired',
11
+ 'celebrate',
12
+ 'sad',
13
+ ];
14
+ export function actorPose(a) {
15
+ if (a.swing)
16
+ return a.swing.type;
17
+ if (a.mood)
18
+ return a.mood.type;
19
+ if (!a.onGround)
20
+ return 'jump';
21
+ if (Math.abs(a.vx) > 10)
22
+ return 'run';
23
+ if (a.holding)
24
+ return 'serve';
25
+ if (a.stamina < TIRED_AT)
26
+ return 'tired';
27
+ return 'idle';
28
+ }
29
+ /** Refreshes `pose` and `stateT` after a step: stateT restarts at 0 on every pose change. */
30
+ export function trackPose(a, dt) {
31
+ const next = actorPose(a);
32
+ if (next !== a.pose) {
33
+ a.pose = next;
34
+ a.stateT = 0;
35
+ }
36
+ else {
37
+ a.stateT += dt;
38
+ }
39
+ }
@@ -0,0 +1,8 @@
1
+ export interface Rng {
2
+ /** Uniform float in [0, 1). */
3
+ next(): number;
4
+ /** Uniform float in [a, b). */
5
+ range(a: number, b: number): number;
6
+ }
7
+ /** mulberry32: small, fast and good enough for gameplay rolls. */
8
+ export declare function createRng(seed: number): Rng;
@@ -0,0 +1,15 @@
1
+ // Seeded random source. Every gameplay roll in the simulation goes through an injected Rng.
2
+ /** mulberry32: small, fast and good enough for gameplay rolls. */
3
+ export function createRng(seed) {
4
+ if (!Number.isFinite(seed))
5
+ throw new RangeError(`createRng: seed must be finite, got ${seed}`);
6
+ let s = Math.trunc(seed) >>> 0;
7
+ const next = () => {
8
+ s = (s + 0x6d2b79f5) >>> 0;
9
+ let t = s;
10
+ t = Math.imul(t ^ (t >>> 15), t | 1);
11
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
12
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
13
+ };
14
+ return { next, range: (a, b) => a + next() * (b - a) };
15
+ }
@@ -0,0 +1,34 @@
1
+ import type { MatchResult, PointReason } from './events.ts';
2
+ import type { Actor, Score, SimCtx, MatchState } from './state.ts';
3
+ import type { Side } from './types.ts';
4
+ /** Serve stances, both inside the service court (behind the short service line): the server a step nearer the net. */
5
+ export declare const SERVE_X: {
6
+ readonly p: {
7
+ readonly serving: number;
8
+ readonly receiving: 600;
9
+ };
10
+ readonly ai: {
11
+ readonly serving: number;
12
+ readonly receiving: 1320;
13
+ };
14
+ };
15
+ /** Until the serve is struck, server and receiver stay in their own service court: behind the short line, inside the back line. */
16
+ export declare function keepInServiceCourt(a: Actor): void;
17
+ export declare const POINT_PAUSE = 1.4;
18
+ export declare const GAME_PAUSE = 2;
19
+ export declare const AI_SERVE_DELAY = 1.1;
20
+ /** True when either side wins the game with its next point. */
21
+ export declare function isGamePoint(score: Score): boolean;
22
+ export declare function gameWinner(score: Score): Side | null;
23
+ export declare const gamesNeeded: (bestOf: number) => number;
24
+ export declare function matchWinner(games: Score, bestOf: number): Side | null;
25
+ /** Puts a held shuttle in its server's free hand, hanging by the feathers. Does nothing while it is not held. */
26
+ export declare function placeHeldShuttle(s: MatchState): void;
27
+ export declare function setupServe(ctx: SimCtx): void;
28
+ /** The shuttle reached the floor: settle the point (or the training ball). */
29
+ export declare function land(ctx: SimCtx): void;
30
+ export declare function awardPoint(ctx: SimCtx, winner: Side, reason: PointReason): void;
31
+ export declare function afterPoint(ctx: SimCtx): void;
32
+ /** Starts the next game after the between-games pause. */
33
+ export declare function nextGame(ctx: SimCtx): void;
34
+ export declare function buildResult(s: MatchState, won: boolean, forfeit: boolean): MatchResult;