A few fixes + draft Interweave and Takenmake. Only 1 1/2 variant to go now :)
[vchess.git] / client / src / variants / Checkered.js
index bca365d..ecf2581 100644 (file)
@@ -177,7 +177,7 @@ export class CheckeredRules extends ChessRules {
   // Does m2 un-do m1 ? (to disallow undoing checkered moves)
   oppositeMoves(m1, m2) {
     return (
-      m1 &&
+      !!m1 &&
       m2.appear[0].c == "c" &&
       m2.appear.length == 1 &&
       m2.vanish.length == 1 &&
@@ -303,7 +303,8 @@ export class CheckeredRules extends ChessRules {
   }
 
   isAttackedByBishop(sq, colors) {
-    return this.isAttackedBySlideNJump(sq, colors, V.BISHOP, V.steps[V.BISHOP]);
+    return this.isAttackedBySlideNJump(
+      sq, colors, V.BISHOP, V.steps[V.BISHOP]);
   }
 
   isAttackedByQueen(sq, colors) {
@@ -337,7 +338,7 @@ export class CheckeredRules extends ChessRules {
       "c"
     ]);
     let res = kingAttacked
-      ? [JSON.parse(JSON.stringify(this.kingPos[color]))] //need to duplicate!
+      ? [JSON.parse(JSON.stringify(this.kingPos[color]))]
       : [];
     this.turn = color;
     return res;