The checkmate scene has one mate: a Scarlet Thief watches d1, so the Oliphant that goes there gives check and dies for it
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CCLa2PaEeCj8njQZSWGqHx
This commit is contained in:
1 parent
b05fe77395
commit
86f861f651
2 files changed
+16
-7
No files matched your search
@@ -52,10 +52,19 @@ describe('the lessons', () => {
|
||||
const king = sceneCells(at('king'));
|
||||
expect(inCheck(king, 'gold')).toBe(true);
|
||||
expect(legalMovesFrom(king, square('2g1'), 'printed').map((i) => i).sort()).toEqual([square('1g1'), square('2f1'), square('2h1'), square('3g1')].sort());
|
||||
// The last scene is mate in one, and only that move mates.
|
||||
// The last scene is mate in one by either listed move, and by no other.
|
||||
const mate = play('mate');
|
||||
expect(inCheck(mate.after.cells, 'scarlet')).toBe(true);
|
||||
expect(hasLegalMove(mate.after.cells, 'scarlet', 'printed')).toBe(false);
|
||||
for (const [from, to] of mate.s.moves) {
|
||||
const after = playOn(mate.cells, square(from), square(to)).cells;
|
||||
expect(inCheck(after, 'scarlet'), `${from} to ${to}`).toBe(true);
|
||||
expect(hasLegalMove(after, 'scarlet', 'printed'), `${from} to ${to}`).toBe(false);
|
||||
}
|
||||
const listed = new Set(mate.s.moves.map(([a, b]) => `${square(a)}-${square(b)}`));
|
||||
for (const to of legalMovesFrom(mate.cells, square('2a1'), 'printed')) {
|
||||
if (listed.has(`${square('2a1')}-${to}`)) continue;
|
||||
const after = playOn(mate.cells, square('2a1'), to).cells;
|
||||
expect(inCheck(after, 'scarlet') && !hasLegalMove(after, 'scarlet', 'printed'), `unlisted mate by the Oliphant to ${to}`).toBe(false);
|
||||
}
|
||||
expect(kindOf(mate.cells[square('2d4')])).toBe('K');
|
||||
expect(frozen(mate.cells, square('2d4'))).toBe(true);
|
||||
void other;
|
||||
|
||||
Reference in new issue
Block a user