Attempt to clarify installation instructions a little
[vchess.git] / client / src / variants / Hypnotic.js
index 130b127..3b67843 100644 (file)
@@ -23,8 +23,8 @@ export class HypnoticRules extends ChessRules {
     );
   }
 
-  static GenRandInitFen(randomness) {
-    return ChessRules.GenRandInitFen(randomness) + " -";
+  static GenRandInitFen(options) {
+    return ChessRules.GenRandInitFen(options) + " -";
   }
 
   setOtherVariables(fen) {
@@ -69,11 +69,26 @@ export class HypnoticRules extends ChessRules {
       this.getPiece(x, y) == V.KING
         // No castling with enemy king (...yes, should eat it but...)
         ? super.getSlideNJumpMoves(
-          [x, y], V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep")
+          [x, y], V.steps[V.ROOK].concat(V.steps[V.BISHOP]), 1)
         : super.getPotentialMovesFrom([x, y]);
     return moves;
   }
 
+  getAllPotentialMoves() {
+    let potentialMoves = [];
+    for (let i = 0; i < V.size.x; i++) {
+      for (let j = 0; j < V.size.y; j++) {
+        if (this.board[i][j] != V.EMPTY) {
+          Array.prototype.push.apply(
+            potentialMoves,
+            this.getPotentialMovesFrom([i, j])
+          );
+        }
+      }
+    }
+    return potentialMoves;
+  }
+
   getEnpassantCaptures([x, y], shiftX) {
     const Lep = this.epSquares.length;
     const epSquare = this.epSquares[Lep - 1]; //always at least one element