-class MarseilleRules extends ChessRules
+import { ChessRules } from "@/base_rules";
+
+export const VariantRules = class MarseilleRules extends ChessRules
{
static IsGoodEnpassant(enpassant)
{
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
};
}
+ // TODO: this is wrong: revise following base_rules.getComputerMove()
// No alpha-beta here, just adapted min-max at depth 2(+1)
getComputerMove()
{
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);
// 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