Several small improvements + integrate options + first working draft of Cwda
[vchess.git] / client / src / variants / Checkered.js
index 5036a82..aac3e02 100644 (file)
@@ -2,6 +2,26 @@ import { ChessRules, Move, PiPo } from "@/base_rules";
 
 export class CheckeredRules extends ChessRules {
 
+  static get Options() {
+    return Object.assign(
+      {},
+      ChessRules.Options,
+      {
+        check: [
+          {
+            label: "With switch",
+            defaut: true,
+            variable: "switch"
+          }
+        ]
+      }
+    );
+  }
+
+  static AbbreviateOptions(opts) {
+    return (!opts["switch"] ? "NS" : "");
+  }
+
   static board2fen(b) {
     const checkered_codes = {
       p: "s",
@@ -41,26 +61,6 @@ export class CheckeredRules extends ChessRules {
     return (b[0] == "c" ? "Checkered/" : "") + b;
   }
 
-  static get Options() {
-    return Object.assign(
-      {},
-      ChessRules.Options,
-      {
-        check: [
-          {
-            label: "With switch",
-            defaut: true,
-            variable: "switch"
-          }
-        ]
-      }
-    );
-  }
-
-  static AbbreviateOptions(opts) {
-    return (!opts["switch"] ? "NS" : "");
-  }
-
   setOtherVariables(fen) {
     super.setOtherVariables(fen);
     // Local stack of non-capturing checkered moves:
@@ -433,12 +433,7 @@ export class CheckeredRules extends ChessRules {
 
   isAttackedByKnight(sq, colors) {
     return this.isAttackedBySlideNJump(
-      sq,
-      colors,
-      V.KNIGHT,
-      V.steps[V.KNIGHT],
-      "oneStep"
-    );
+      sq, colors, V.KNIGHT, V.steps[V.KNIGHT], "oneStep");
   }
 
   isAttackedByBishop(sq, colors) {
@@ -448,20 +443,13 @@ export class CheckeredRules extends ChessRules {
 
   isAttackedByQueen(sq, colors) {
     return this.isAttackedBySlideNJump(
-      sq,
-      colors,
-      V.QUEEN,
-      V.steps[V.ROOK].concat(V.steps[V.BISHOP])
-    );
+      sq, colors, V.QUEEN, V.steps[V.ROOK].concat(V.steps[V.BISHOP]));
   }
 
   isAttackedByKing(sq, colors) {
     return this.isAttackedBySlideNJump(
-      sq,
-      colors,
-      V.KING,
-      V.steps[V.ROOK].concat(V.steps[V.BISHOP]),
-      "oneStep"
+      sq, colors, V.KING,
+      V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep"
     );
   }