Several small improvements + integrate options + first working draft of Cwda
[vchess.git] / client / src / variants / Recycle.js
index d23a78c..de0ff50 100644 (file)
@@ -2,6 +2,7 @@ import { ChessRules, PiPo, Move } from "@/base_rules";
 import { ArrayFun } from "@/utils/array";
 
 export class RecycleRules extends ChessRules {
+
   static get PawnSpecs() {
     return Object.assign(
       {},
@@ -27,8 +28,8 @@ export class RecycleRules extends ChessRules {
     );
   }
 
-  static GenRandInitFen(randomness) {
-    return ChessRules.GenRandInitFen(randomness) + " 0000000000";
+  static GenRandInitFen(options) {
+    return ChessRules.GenRandInitFen(options) + " 0000000000";
   }
 
   getFen() {
@@ -85,6 +86,14 @@ export class RecycleRules extends ChessRules {
     return this.board[i][j].charAt(1);
   }
 
+  getPPpath(m) {
+    if (m.vanish.length == 2 && m.appear.length == 2) {
+      // Castle: show castle symbol
+      return "Coregal/castle";
+    }
+    return super.getPPpath(m);
+  }
+
   // Used by the interface:
   getReservePpath(index, color) {
     return color + V.RESERVE_PIECES[index];
@@ -227,4 +236,5 @@ export class RecycleRules extends ChessRules {
       move.appear[0].p != V.PAWN ? move.appear[0].p.toUpperCase() : "";
     return piece + "@" + V.CoordsToSquare(move.end);
   }
+
 };