Several small improvements + integrate options + first working draft of Cwda
[vchess.git] / client / src / variants / Otage.js
index 451059a..caf55c9 100644 (file)
@@ -197,9 +197,9 @@ export class OtageRules extends ChessRules {
     this.pawnFlags = flags[1];
   }
 
-  static GenRandInitFen(randomness) {
+  static GenRandInitFen(options) {
     // Add 16 pawns flags:
-    return ChessRules.GenRandInitFen(randomness)
+    return ChessRules.GenRandInitFen(options)
       .slice(0, -2) + "1111111111111111 -";
   }
 
@@ -355,7 +355,7 @@ export class OtageRules extends ChessRules {
     }
     let baseMoves = [];
     const c = this.turn;
-    switch (piece || this.getPiece(x, y)) {
+    switch (piece) {
       case V.PAWN: {
         const firstRank = (c == 'w' ? 7 : 0);
         baseMoves = this.getPotentialPawnMoves([x, y]).filter(m => {
@@ -390,10 +390,7 @@ export class OtageRules extends ChessRules {
         break;
       case V.KING:
         baseMoves = this.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);
         if (!noCastle && this.castleFlags[this.turn].some(v => v < V.size.y))
           baseMoves = baseMoves.concat(this.getCastleMoves([x, y]));
         break;