import { ChessRules } from "@/base_rules";
import { randInt } from "@/utils/alea";
-export class SynchroneRules extends ChessRules {
+export class Synchrone1Rules extends ChessRules {
static get CanAnalyze() {
return false;
static ParseFen(fen) {
const fenParts = fen.split(" ");
return Object.assign(
- ChessRules.ParseFen(fen),
- { whiteMove: fenParts[5] }
+ { whiteMove: fenParts[5] },
+ ChessRules.ParseFen(fen)
);
}
const epArray = parsedFen.enpassant.split(",");
this.epSquares = [];
epArray.forEach(epsq => this.epSquares.push(this.getEpSquare(epsq)));
- super.scanKings(fen);
+ this.scanKings();
// Also init whiteMove
this.whiteMove =
parsedFen.whiteMove != "-"
// Castle
smove.appear.push(m1.appear[1]);
smove.vanish.push(m1.vanish[1]);
- } else if (
+ }
+ else if (
m1.vanish.length == 2 &&
(
m1.vanish[1].x != m2.start.x ||
// Castle
smove.appear.push(m2.appear[1]);
smove.vanish.push(m2.vanish[1]);
- } else if (
+ }
+ else if (
m2.vanish.length == 2 &&
(
m2.vanish[1].x != m1.start.x ||
) {
smove.vanish.push(m2.vanish[1]);
}
- } else {
+ }
+ else {
// Collision:
if (m1.vanish.length == 1 && m2.vanish.length == 1) {
// Easy case: both disappear except if one is a king
c: (p1 == V.KING ? 'w' : 'b')
});
}
- } else {
+ }
+ else {
// One move is a self-capture and the other a normal capture:
// only the self-capture appears
const selfCaptureMove =
this.scanKings();
// Also reset whiteMove
this.whiteMove = null;
- } else this.whiteMove = move.whiteMove;
+ }
+ else this.whiteMove = move.whiteMove;
}
getCheckSquares() {