Debug Knightrelay variant
[vchess.git] / client / src / variants / Baroque.js
index 79fc73c..8f1f9ba 100644 (file)
@@ -11,17 +11,17 @@ export const VariantRules = class BaroqueRules extends ChessRules {
     return false;
   }
 
-  static getPpath(b) {
+  static get PIECES() {
+    return ChessRules.PIECES.concat([V.IMMOBILIZER]);
+  }
+
+  getPpath(b) {
     if (b[1] == "m")
       //'m' for Immobilizer (I is too similar to 1)
       return "Baroque/" + b;
     return b; //usual piece
   }
 
-  static get PIECES() {
-    return ChessRules.PIECES.concat([V.IMMOBILIZER]);
-  }
-
   // No castling, but checks, so keep track of kings
   setOtherVariables(fen) {
     this.kingPos = { w: [-1, -1], b: [-1, -1] };
@@ -203,7 +203,6 @@ export const VariantRules = class BaroqueRules extends ChessRules {
     return moves;
   }
 
-  // Long-leaper
   getKnightCaptures(startSquare, byChameleon) {
     // Look in every direction for captures
     const steps = V.steps[V.ROOK].concat(V.steps[V.BISHOP]);
@@ -271,6 +270,7 @@ export const VariantRules = class BaroqueRules extends ChessRules {
     return super.getPotentialQueenMoves(sq).concat(this.getKnightCaptures(sq));
   }
 
+  // Chameleon
   getPotentialBishopMoves([x, y]) {
     let moves = super
       .getPotentialQueenMoves([x, y])
@@ -297,7 +297,6 @@ export const VariantRules = class BaroqueRules extends ChessRules {
     return moves;
   }
 
-  // Withdrawer
   addQueenCaptures(moves, byChameleon) {
     if (moves.length == 0) return;
     const [x, y] = [moves[0].start.x, moves[0].start.y];
@@ -341,6 +340,7 @@ export const VariantRules = class BaroqueRules extends ChessRules {
     });
   }
 
+  // Withdrawer
   getPotentialQueenMoves(sq) {
     let moves = super.getPotentialQueenMoves(sq);
     this.addQueenCaptures(moves);
@@ -591,7 +591,8 @@ export const VariantRules = class BaroqueRules extends ChessRules {
     } else if (move.appear[0].p == V.KING)
       notation = "K" + (move.vanish.length > 1 ? "x" : "") + finalSquare;
     else notation = move.appear[0].p.toUpperCase() + finalSquare;
-    if (move.vanish.length > 1 && move.appear[0].p != V.KING) notation += "X"; //capture mark (not describing what is captured...)
+    // Add a capture mark (not describing what is captured...):
+    if (move.vanish.length > 1 && move.appear[0].p != V.KING) notation += "X";
     return notation;
   }
 };