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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user