X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FMarseille.js;h=9b1d4eaee226244f6458fd2af17721d46577597b;hb=829f65746b68955ad255e489c480fde613463e61;hp=2d4ecfa4207a31f778ccaf7107f0db949bacde7a;hpb=8d61fc4ab7373b4a576f3f9108cdf7768ae27096;p=vchess.git diff --git a/client/src/variants/Marseille.js b/client/src/variants/Marseille.js index 2d4ecfa4..9b1d4eae 100644 --- a/client/src/variants/Marseille.js +++ b/client/src/variants/Marseille.js @@ -1,4 +1,6 @@ -class MarseilleRules extends ChessRules +import { ChessRules } from "@/base_rules"; + +export const VariantRules = class MarseilleRules extends ChessRules { static IsGoodEnpassant(enpassant) { @@ -144,12 +146,13 @@ class MarseilleRules extends ChessRules play(move) { move.flags = JSON.stringify(this.aggregateFlags()); - move.turn = this.turn + this.subturn; + move.turn = this.turn + this.subTurn; V.PlayOnBoard(this.board, move); const epSq = this.getEpSquare(move); if (this.subTurn == 0) //first move in game { this.turn = "b"; + this.subTurn = 1; this.epSquares.push([epSq]); } // Does this move give check on subturn 1? If yes, skip subturn 2 @@ -205,6 +208,7 @@ class MarseilleRules extends ChessRules }; } + // TODO: this is wrong: revise following base_rules.getComputerMove() // No alpha-beta here, just adapted min-max at depth 2(+1) getComputerMove() { @@ -221,7 +225,7 @@ class MarseilleRules extends ChessRules let moves = this.getAllValidMoves(); if (moves.length == 0) { - const score = this.checkGameEnd(); + const score = this.getCurrentScore(); if (score == "1/2") return 0; return maxeval * (score == "1-0" ? 1 : -1); @@ -234,7 +238,7 @@ class MarseilleRules extends ChessRules // Otherwise it's color,1. In both cases the next test makes sense if (!this.atLeastOneMove()) { - const score = this.checkGameEnd(); + const score = this.getCurrentScore(); if (score == "1/2") res = (oppCol == "w" ? Math.max(res, 0) : Math.min(res, 0)); else