docs(bot): clarify when scoreMove early-return fires
This commit is contained in:
@@ -82,7 +82,11 @@ export class CasualBrain implements Brain {
|
|||||||
if (!destPiece) score += 50;
|
if (!destPiece) score += 50;
|
||||||
|
|
||||||
const piece = view.pieces[move.from];
|
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 ownStartingRank = this.color === 'w' ? '1' : '8';
|
||||||
const ownPawnStartingRank = this.color === 'w' ? '2' : '7';
|
const ownPawnStartingRank = this.color === 'w' ? '2' : '7';
|
||||||
|
|||||||
Reference in New Issue
Block a user