Merge remote-tracking branch 'origin/match-et-reglages' into conseil-du-maitre

# Conflicts:
#	app/src/ui/board-view.ts
#	tests/browser.sh
This commit is contained in:
Pierre MARTIN
2026-11-10 05:08:23 +01:00
16 changed files with 485 additions and 51 deletions
+12 -1
View File
@@ -25,7 +25,7 @@ import {
type NewGameEvent,
withAdvice,
} from "./events.js";
import { type Match, nextGameOf } from "./match.js";
import { firstGameOf, type Match, nextGameOf } from "./match.js";
import { BAR, type HalfMove, OFF, type PositionId, START_POSITION } from "./position.js";
import { type DiceSource, type Roll, randomDice, rollDice } from "./roll.js";
import { otherSide, type Side } from "./side.js";
@@ -168,6 +168,17 @@ export class Game {
return match === null ? null : { level: state.level, match };
}
/** « Rejouer » : une nouvelle partie aux mêmes réglages que celle-ci,
* au même niveau ; pour un match, un nouveau match de même longueur,
* à 0 à 0. Une partie commencée à une position donnée se rejoue depuis
* la position de départ. */
get rematch(): NewGame {
const state = this.state;
return state.match === null
? { level: state.level }
: { level: state.level, match: firstGameOf(state.match.length) };
}
/** Les demi-coups déjà saisis du coup en cours. */
get pendingHalfMoves(): readonly HalfMove[] {
return this.#pending.map((p) => p.halfMove);