class LoserRules extends ChessRules
{
- initVariables(fen)
- {
- const epSq = this.moves.length > 0 ? this.getEpSquare(this.lastMove) : undefined;
- this.epSquares = [ epSq ];
- }
-
- static IsGoodFlags(flags)
- {
- return true; //anything is good: no flags
- }
-
- setFlags(fen)
- {
- // No castling, hence no flags; but flags defined for compatibility
- this.castleFlags = { "w":[false,false], "b":[false,false] };
- }
+ static get HasFlags() { return false; }
getPotentialPawnMoves([x,y])
{
getPotentialKingMoves(sq)
{
+ // No castle:
return this.getSlideNJumpMoves(sq,
V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep");
}
return moves;
}
- underCheck(move)
+ underCheck(color)
{
return false; //No notion of check
}
return [];
}
- // Unused:
+ // No variables update because no royal king + 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
}
}
+
+const VariantRules = LoserRules;