docs(server): correct translateMove audience docs after the 'both' change
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -112,7 +112,7 @@ function announceWith(
|
|||||||
text: 'no_such_piece' | 'no_legal_moves' | 'wont_help' | 'illegal_move',
|
text: 'no_such_piece' | 'no_legal_moves' | 'wont_help' | 'illegal_move',
|
||||||
): CommitResult {
|
): CommitResult {
|
||||||
const ply = game.chess.history().length;
|
const ply = game.chess.history().length;
|
||||||
// Feature 1: attempted moves are announced to both players.
|
// Attempted moves are part of the shared moderator transcript — both players hear them.
|
||||||
const a = announce(text, 'both', ply);
|
const a = announce(text, 'both', ply);
|
||||||
game.announcements.push(a);
|
game.announcements.push(a);
|
||||||
return { kind: 'announce', announcements: [a] };
|
return { kind: 'announce', announcements: [a] };
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ export function announce(
|
|||||||
/**
|
/**
|
||||||
* Translate an applied chess.js Move into the moderator vocabulary.
|
* Translate an applied chess.js Move into the moderator vocabulary.
|
||||||
*
|
*
|
||||||
* Capturing player learns the captured piece type via their `view` update
|
* Every announcement is emitted with audience 'both' — the moderator speaks
|
||||||
* (their canonical board reflects the capture; the captured-pieces tray is
|
* each event aloud and both players hear it. Move events carry no square
|
||||||
* populated from move history). The opponent gets only the `*_moved_captured`
|
* coordinates, so a player learns *that* the opponent moved / captured /
|
||||||
* announcement.
|
* castled, never *where*. The capturing player additionally sees the capture
|
||||||
|
* reflected in their own view update.
|
||||||
*/
|
*/
|
||||||
export function translateMove(game: Game, move: Move): Announcement[] {
|
export function translateMove(game: Game, move: Move): Announcement[] {
|
||||||
const out: Announcement[] = [];
|
const out: Announcement[] = [];
|
||||||
@@ -33,8 +34,7 @@ export function translateMove(game: Game, move: Move): Announcement[] {
|
|||||||
const isQueensideCastle = move.isQueensideCastle();
|
const isQueensideCastle = move.isQueensideCastle();
|
||||||
const isProm = !!move.promotion;
|
const isProm = !!move.promotion;
|
||||||
|
|
||||||
// To both players: the move event itself (Feature 1 — the moderator
|
// The move event itself — the moderator announces every move aloud, so both players hear it.
|
||||||
// announces every move aloud; both players hear it).
|
|
||||||
if (isKingsideCastle) {
|
if (isKingsideCastle) {
|
||||||
out.push(announce(`${moverWord}_castled_kingside` as ModeratorText, 'both', ply));
|
out.push(announce(`${moverWord}_castled_kingside` as ModeratorText, 'both', ply));
|
||||||
} else if (isQueensideCastle) {
|
} else if (isQueensideCastle) {
|
||||||
|
|||||||
Reference in New Issue
Block a user