X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FLoser.js;h=dcc5c112e9740083edfc6f61fb3583953320ef23;hb=f6dbe8e31a3260487664f1e0b50710b3f3efaf5f;hp=2d60d6e8fc10a8aa4d91241d327441220da33997;hpb=c794dbb87592782913af0a09784ed25e019e4d10;p=vchess.git diff --git a/public/javascripts/variants/Loser.js b/public/javascripts/variants/Loser.js index 2d60d6e8..dcc5c112 100644 --- a/public/javascripts/variants/Loser.js +++ b/public/javascripts/variants/Loser.js @@ -1,21 +1,6 @@ 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(fenflags) - { - // 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]) { @@ -48,6 +33,7 @@ class LoserRules extends ChessRules getPotentialKingMoves(sq) { + // No castle: return this.getSlideNJumpMoves(sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep"); } @@ -101,7 +87,7 @@ class LoserRules extends ChessRules return moves; } - underCheck(move) + underCheck(color) { return false; //No notion of check } @@ -111,22 +97,19 @@ class LoserRules extends ChessRules 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, @@ -197,6 +180,8 @@ class LoserRules extends ChessRules return pieces["b"].join("") + "/pppppppp/8/8/8/8/PPPPPPPP/" + pieces["w"].join("").toUpperCase() + - " 0000 w"; //add flags (TODO?!) + " w -"; //no en-passant } } + +const VariantRules = LoserRules;