Several small improvements + integrate options + first working draft of Cwda
[vchess.git] / client / src / variants / Doublearmy.js
index 0fafe96..87d262a 100644 (file)
@@ -3,9 +3,10 @@ import { ChessRules } from "@/base_rules";
 // Ideas with 2 kings:
 // Stage 1 {w, b} : 2 kings on board, value 5.
 // Stage 2: only one, get mated and all that, value 1000
-// ...But the middle king will get captured quickly...
+// ...But the middle king will be captured quickly...
 
 export class DoublearmyRules extends ChessRules {
+
   static get COMMONER() {
     return "c";
   }
@@ -18,8 +19,8 @@ export class DoublearmyRules extends ChessRules {
     return (b[1] == V.COMMONER ? "Doublearmy/" : "") + b;
   }
 
-  static GenRandInitFen(randomness) {
-    const fen = ChessRules.GenRandInitFen(randomness);
+  static GenRandInitFen(options) {
+    const fen = ChessRules.GenRandInitFen(options);
     const rows = fen.split(" ")[0].split("/");
     return (
       rows[0] + "/" +
@@ -44,10 +45,7 @@ export class DoublearmyRules extends ChessRules {
 
   getPotentialCommonerMoves(sq) {
     return this.getSlideNJumpMoves(
-      sq,
-      V.steps[V.ROOK].concat(V.steps[V.BISHOP]),
-      "oneStep"
-    );
+      sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), 1);
   }
 
   isAttacked(sq, color) {
@@ -59,23 +57,18 @@ export class DoublearmyRules extends ChessRules {
 
   isAttackedByCommoner(sq, color) {
     return this.isAttackedBySlideNJump(
-      sq,
-      color,
-      V.COMMONER,
-      V.steps[V.ROOK].concat(V.steps[V.BISHOP]),
-      "oneStep"
-    );
+      sq, color, V.COMMONER, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), 1);
   }
 
   static get VALUES() {
     return Object.assign(
-      {},
-      ChessRules.VALUES,
-      { c: 5 }
+      { c: 5 },
+      ChessRules.VALUES
     );
   }
 
   static get SEARCH_DEPTH() {
     return 2;
   }
+
 };