// cb: callback returning a boolean (false if king missing)
trackKingWrap(move, kingPos, cb) {
+ if (move.appear.length == 0 && move.vanish.length == 0)
+ return true;
+ const color =
+ (move.vanish.length > 0 ? move.vanish[0].c : move.appear[0].c);
let newKingPP = null,
sqIdx = 0,
res = true; //a priori valid
}
filterValid(moves) {
- fmoves = super.filterValid(moves);
+ const fmoves = super.filterValid(moves);
// Filter out moves giving check but not checkmate
const color = this.turn;
const oppCol = C.GetOppTurn(color);
const res = this.trackKingWrap(m, oppKingPos, (oppKp) => {
return (
!this.underCheck(oppKp, [color]) ||
- this.atLeastOneMove_aux(oppKp, kingPos, oppCol, color)
+ !this.atLeastOneMove_aux(oppKp, kingPos, oppCol, color)
);
});
this.undoOnBoard(m);