refactor(bot): hoist the rejection announcement to a single local

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
claude (blind_chess)
2026-05-18 20:03:37 -04:00
parent 558891ed37
commit 5282237027
+2 -2
View File
@@ -162,7 +162,8 @@ export class BotDriver {
return { kind: 'done' };
}
if (result.kind === 'announce') {
const text = result.announcements[0]!.text;
const rejection = result.announcements[0]!;
const text = rejection.text;
if (text === 'wont_help' || text === 'illegal_move'
|| text === 'no_such_piece' || text === 'no_legal_moves') {
// Attempted-move announcements are audience 'both'. The bot's
@@ -172,7 +173,6 @@ export class BotDriver {
// so removing the announcement is safe. The whole decision cycle
// runs before ws.ts broadcasts, so this pop always happens before
// any broadcast.
const rejection = result.announcements[0]!;
const anns = this.game.announcements;
if (anns[anns.length - 1] === rejection) anns.pop();
return {