Simplify Monster + Doublemove2. Smoother example games
[vchess.git] / client / src / variants / Suction.js
index aa34f6c..c3277e9 100644 (file)
@@ -1,6 +1,15 @@
 import { ChessRules, PiPo, Move } from "@/base_rules";
 
 export class SuctionRules extends ChessRules {
+  static get PawnSpecs() {
+    return Object.assign(
+      {},
+      ChessRules.PawnSpecs,
+      // No promotions:
+      { promotions: [V.PAWN] }
+    );
+  }
+
   static get HasFlags() {
     return false;
   }
@@ -144,13 +153,22 @@ export class SuctionRules extends ChessRules {
     return ChessRules.GenRandInitFen(randomness).slice(0, -6) + "- -";
   }
 
-  getFen() {
+  getCmoveFen() {
     const L = this.cmoves.length;
-    const cmoveFen = !this.cmoves[L - 1]
-      ? "-"
-      : ChessRules.CoordsToSquare(this.cmoves[L - 1].start) +
-        ChessRules.CoordsToSquare(this.cmoves[L - 1].end);
-    return super.getFen() + " " + cmoveFen;
+    return (
+      !this.cmoves[L - 1]
+        ? "-"
+        : ChessRules.CoordsToSquare(this.cmoves[L - 1].start) +
+          ChessRules.CoordsToSquare(this.cmoves[L - 1].end)
+    );
+  }
+
+  getFen() {
+    return super.getFen() + " " + this.getCmoveFen();
+  }
+
+  getFenForRepeat() {
+    return super.getFenForRepeat() + "_" + this.getCmoveFen();
   }
 
   postPlay(move) {