class LoserRules extends ChessRules
{
- initVariables(fen)
- {
- const epSq = this.moves.length > 0 ? this.getEpSquare(this.lastMove) : undefined;
- this.epSquares = [ epSq ];
- }
+ static get HasFlags() { return false; }
- setFlags(fen)
+ setOtherVariables(fen)
{
- // No castling, hence no flags; but flags defined for compatibility
- this.castleFlags = { "w":[false,false], "b":[false,false] };
+ const parsedFen = V.ParseFen(fen);
+ const epSq = parsedFen.enpassant != "-"
+ ? V.SquareToCoords(parsedFen.enpassant)
+ : undefined;
+ this.epSquares = [ epSq ];
+ this.scanKingsRooks(fen);
}
getPotentialPawnMoves([x,y])
getPotentialKingMoves(sq)
{
+ // No castle:
return this.getSlideNJumpMoves(sq,
V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep");
}
return [];
}
- // Unused:
+ // No variables update because no castling
updateVariables(move) { }
unupdateVariables(move) { }
- getFlagsFen()
- {
- return "-";
- }
-
checkGameEnd()
{
// No valid move: you win!
return this.turn == "w" ? "1-0" : "0-1";
}
- static get VALUES() { //experimental...
+ static get VALUES()
+ {
+ // Experimental...
return {
'p': 1,
'r': 7,
return pieces["b"].join("") +
"/pppppppp/8/8/8/8/PPPPPPPP/" +
pieces["w"].join("").toUpperCase() +
- " 0000"; //add flags (TODO?!)
+ " w -"; //no en-passant
}
}