);
}
+ static IsGoodEnpassant(enpassant)
+ {
+ if (enpassant != "-")
+ {
+ const squares = enpassant.split(",");
+ if (squares.length > 2)
+ return false;
+ for (let sq of squares)
+ {
+ const ep = V.SquareToCoords(sq);
+ if (isNaN(ep.x) || !V.OnBoard(ep))
+ return false;
+ }
+ }
+ return true;
+ }
+
// There may be 2 enPassant squares (if pawn jump 3 squares)
getEnpassantFen()
{
// TODO: some redundant checks
if (epsq.x == x+shift && Math.abs(epsq.y - y) == 1)
{
- let epStep = epsq.y - y;
- var enpassantMove = this.getBasicMove([x,y], [x+shift,y+epStep]);
+ var enpassantMove = this.getBasicMove([x,y], [x+shift,epsq.y]);
enpassantMove.vanish.push({
x: x,
- y: y+epStep,
+ y: epsq.y,
p: 'p',
- c: this.getColor(x,y+epStep)
+ c: this.getColor(x,epsq.y)
});
moves.push(enpassantMove);
}