1 class ExtinctionRules
extends ChessRules
5 super.initVariables(fen
);
6 const V
= VariantRules
;
30 // TODO: verify this assertion
33 return true; //always at least one possible move
38 return false; //there is no check
48 super.updateVariables(move);
49 if (move.vanish
.length
==2 && move.appear
.length
==1)
50 this.material
[move.vanish
[1].c
][move.vanish
[1].p
]--;
53 unupdateVariables(move)
55 super.unupdateVariables(move);
56 if (move.vanish
.length
==2 && move.appear
.length
==1)
57 this.material
[move.vanish
[1].c
][move.vanish
[1].p
]++;
62 if (this.checkRepetition())
65 if (this.atLeastOneMove()) // game not over?
67 const color
= this.turn
;
68 if (Object
.keys(this.material
[color
]).some(
69 p
=> { return this.material
[color
][p
] == 0; }))
71 return this.checkGameEnd();
76 return this.checkGameEnd();
79 // Very negative (resp. positive) if white (reps. black) pieces set is incomplete
83 return (this.turn
=="w"?-1:1) * VariantRules
.INFINITY
;
84 return super.evalPosition();