X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FExtinction.js;h=748f9e46d3e488a4d7f7e34abcaf01fc96fa642e;hb=0c3fe8a6c3e02af46e0bc646b40c1a0c420f9dcd;hp=aab359f8a0fd1c48db871b033d51a2516442f65f;hpb=8d61fc4ab7373b4a576f3f9108cdf7768ae27096;p=vchess.git diff --git a/client/src/variants/Extinction.js b/client/src/variants/Extinction.js index aab359f8..748f9e46 100644 --- a/client/src/variants/Extinction.js +++ b/client/src/variants/Extinction.js @@ -1,4 +1,6 @@ -class ExtinctionRules extends ChessRules +import { ChessRules } from "@/base_rules"; + +export const VariantRules = class ExtinctionRules extends ChessRules { setOtherVariables(fen) { @@ -99,28 +101,20 @@ class ExtinctionRules extends ChessRules this.material[move.vanish[1].c][move.vanish[1].p]++; } - checkGameOver() + getCurrentScore() { - if (this.checkRepetition()) - return "1/2"; - if (this.atLeastOneMove()) // game not over? { const color = this.turn; if (Object.keys(this.material[color]).some( p => { return this.material[color][p] == 0; })) { - return this.checkGameEnd(); + return (this.turn == "w" ? "0-1" : "1-0"); } return "*"; } - return this.checkGameEnd(); //NOTE: currently unreachable... - } - - checkGameEnd() - { - return (this.turn == "w" ? "0-1" : "1-0"); + return (this.turn == "w" ? "0-1" : "1-0"); //NOTE: currently unreachable... } evalPosition()