From ebd1463b0ac2c067d017a02ec6d940f5e51166f7 Mon Sep 17 00:00:00 2001 From: "claude (blind_chess)" Date: Tue, 28 Apr 2026 13:52:22 -0400 Subject: [PATCH] docs(bot): clarify when scoreMove early-return fires --- packages/server/src/bot/casual-brain.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/server/src/bot/casual-brain.ts b/packages/server/src/bot/casual-brain.ts index adcdb85..8a4ffa2 100644 --- a/packages/server/src/bot/casual-brain.ts +++ b/packages/server/src/bot/casual-brain.ts @@ -82,7 +82,11 @@ export class CasualBrain implements Brain { if (!destPiece) score += 50; const piece = view.pieces[move.from]; - if (!piece) return score; // shouldn't happen, but safe. + // Reachable when scoring tests pass minimal fixture views. In real play + // the candidate's `from` is always one of our pieces (since candidates + // came from `legalCandidates` over our own squares), but the early + // return keeps unit tests from needing full board fixtures. + if (!piece) return score; const ownStartingRank = this.color === 'w' ? '1' : '8'; const ownPawnStartingRank = this.color === 'w' ? '2' : '7';