Several small improvements + integrate options + first working draft of Cwda
[vchess.git] / client / src / variants / Avalanche.js
index edeb564..40a4393 100644 (file)
@@ -25,6 +25,7 @@ export class AvalancheRules extends ChessRules {
   }
 
   canIplay(side, [x, y]) {
+    if (side != this.turn) return false;
     if (this.subTurn == 0) return (x >= V.size.x);
     const c = this.getColor(x, y);
     return (
@@ -339,6 +340,7 @@ export class AvalancheRules extends ChessRules {
       this.play(moves[3]); //HACK... 3 = queen index
       const res = this.getComputerMove();
       this.undo(moves[3]);
+      if (Array.isArray(res)) return [moves[3]].concat(res);
       return [moves[3], res];
     }
     // subTurn == 1 (necessarily)