+import { SuicideRules } from "@/variants/Suicide";
+
+export class SuctionRules extends ChessRules {
+
+ static get PawnSpecs() {
+ return Object.assign(
+ {},
+ ChessRules.PawnSpecs,
+ // No promotions:
+ { promotions: [V.PAWN] }
+ );
+ }
+
+ static get HasFlags() {
+ return false;
+ }
+
+ setOtherVariables(fen) {
+ super.setOtherVariables(fen);
+ // Local stack of "captures"
+ this.cmoves = [];
+ const cmove = V.ParseFen(fen).cmove;
+ if (cmove == "-") this.cmoves.push(null);
+ else {
+ this.cmoves.push({
+ start: ChessRules.SquareToCoords(cmove.substr(0, 2)),
+ end: ChessRules.SquareToCoords(cmove.substr(2))
+ });
+ }
+ }
+
+ static ParseFen(fen) {
+ return Object.assign(
+ ChessRules.ParseFen(fen),
+ { cmove: fen.split(" ")[4] }
+ );
+ }
+
+ static IsGoodFen(fen) {
+ if (!ChessRules.IsGoodFen(fen)) return false;
+ const fenParts = fen.split(" ");
+ if (fenParts.length != 5) return false;
+ if (fenParts[4] != "-" && !fenParts[4].match(/^([a-h][1-8]){2}$/))
+ return false;
+ return true;
+ }
+
+ getCmove(move) {
+ if (move.vanish.length == 2)
+ return { start: move.start, end: move.end };
+ return null;
+ }