Fix games ordering in MyGames, fix en-passant mistake in Rifle variant
[vchess.git] / client / src / variants / Recycle.js
index 50ccd74..73d9166 100644 (file)
@@ -18,8 +18,15 @@ export const VariantRules = class RecycleRules extends ChessRules {
     });
   }
 
-  static GenRandInitFen() {
-    return ChessRules.GenRandInitFen() + " 0000000000";
+  getEpSquare(moveOrSquare) {
+    if (typeof moveOrSquare !== "object" || move.vanish.length > 0)
+      return super.getEpSquare(moveOrSquare);
+    // Landing move: no en-passant
+    return undefined;
+  }
+
+  static GenRandInitFen(randomness) {
+    return ChessRules.GenRandInitFen(randomness) + " 0000000000";
   }
 
   getFen() {
@@ -28,6 +35,16 @@ export const VariantRules = class RecycleRules extends ChessRules {
     );
   }
 
+  getFenForRepeat() {
+    return (
+      this.getBaseFen() + "_" +
+      this.getTurnFen() + "_" +
+      this.getFlagsFen() + "_" +
+      this.getEnpassantFen() + "_" +
+      this.getReserveFen()
+    );
+  }
+
   getReserveFen() {
     let counts = new Array(10);
     for (