X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FKoth.js;h=38e1010852d177769bb2dcb6deb3432e51d04350;hb=HEAD;hp=e286862d9c360b8e8505a9ff1e1d4be4b5b5cbe6;hpb=236485b53993f2adfd588022e2899a39491fc825;p=vchess.git diff --git a/client/src/variants/Koth.js b/client/src/variants/Koth.js index e286862d..38e10108 100644 --- a/client/src/variants/Koth.js +++ b/client/src/variants/Koth.js @@ -1,17 +1,14 @@ import { ChessRules } from "@/base_rules"; export class KothRules extends ChessRules { - filterValid(moves) { - if (moves.length == 0) return []; - const color = this.turn; - const oppCol = V.GetOppCol(color); - return moves.filter(m => { - this.play(m); - // Giving check is forbidden as well: - const res = !this.underCheck(color) && !this.underCheck(oppCol); - this.undo(m); - return res; - }); + + static get Lines() { + return [ + [[3, 3], [3, 5]], + [[3, 3], [5, 3]], + [[3, 5], [5, 5]], + [[5, 3], [5, 5]] + ]; } getCurrentScore() { @@ -24,9 +21,7 @@ export class KothRules extends ChessRules { // The middle is reached! return color == "w" ? "1-0" : "0-1"; } - if (this.atLeastOneMove()) return "*"; - // Stalemate (will probably never happen) - return "1/2"; + return super.getCurrentScore(); } evalPosition() { @@ -45,4 +40,5 @@ export class KothRules extends ChessRules { ) / 2 ); } + };