Merge remote-tracking branch 'origin/main' into prompts

This commit is contained in:
Pierre MARTIN
2026-11-11 21:54:32 +01:00
13 changed files with 499 additions and 19 deletions
+6 -5
View File
@@ -38,7 +38,7 @@ import type { Advice } from "../domain/game/advice.js";
import type { Cube } from "../domain/game/cube.js";
import type { GameJournal } from "../domain/game/events.js";
import type { Game, MoveSteps, NewGame, SideBoards } from "../domain/game/game.js";
import { formatHalfMoves, type HalfMove } from "../domain/game/position.js";
import type { HalfMove } from "../domain/game/position.js";
import { type PositionLink, type SharedPosition, setupOf } from "../domain/game/position-link.js";
import type { SavedGameSummary } from "../domain/game/saved-game.js";
import { otherSide, type Side } from "../domain/game/side.js";
@@ -1037,7 +1037,7 @@ export function startApp(options: AppOptions): void {
while (game !== null && game.state.turn === "computer" && isPlaying(game)) {
await refresh();
await game.playComputerTurn();
info = describeComputerTurn(game);
info = await describeComputerTurn(game);
save();
played = true;
}
@@ -2661,8 +2661,9 @@ async function computerMoveToShow(game: Game): Promise<MoveSteps | null> {
return game.lastMoveSteps();
}
/** Ce qu'a fait l'ordinateur pendant son tour (sans durée de calcul). */
function describeComputerTurn(game: Game): string {
/** Ce qu'a fait l'ordinateur pendant son tour (sans durée de calcul). Son
* coup s'écrit dans la notation du moteur, comme dans l'analyse. */
async function describeComputerTurn(game: Game): Promise<string> {
const last = game.events.at(-1);
if (last?.type === "CubeOffered") {
return "";
@@ -2675,7 +2676,7 @@ function describeComputerTurn(game: Game): string {
if (played.halfMoves.length === 0) {
return TEXTS.computerCannotMove(dice);
}
return TEXTS.computerMoved(dice, formatHalfMoves(played.halfMoves));
return TEXTS.computerMoved(dice, await game.moveNotation(played.id));
}
/** Le résultat d'une partie finie, en deux parties : le titre du panneau