+ static IsGoodEnpassant(enpassant) {
+ if (enpassant != "-") {
+ const epParts = enpassant.split(",");
+ const epSq = V.SquareToCoords(epParts[0]);
+ if (isNaN(epSq.x) || isNaN(epSq.y) || !V.OnBoard(epSq)) return false;
+ const arrCol = V.ColumnToCoord(epParts[1]);
+ if (isNaN(arrCol) || arrCol < 0 || arrCol >= V.size.y) return false;
+ }
+ return true;
+ }
+
+ getEnpassantFen() {
+ const L = this.epSquares.length;
+ if (!this.epSquares[L - 1]) return "-"; //no en-passant
+ return (
+ V.CoordsToSquare(this.epSquares[L - 1][0]) +
+ "," +
+ V.CoordToColumn(this.epSquares[L - 1][1])
+ );
+ }
+