Really TODO this TwoSquareMove ?!
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 4 Nov 2026 15:03:06 +0000 (16:03 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 4 Nov 2026 15:03:06 +0000 (16:03 +0100)
variants/Fanorona/class.js

index d88b5b6..f1f4ba8 100644 (file)
@@ -203,10 +203,21 @@ export default class FanoronaRules extends AbstractOnGridRules {
     const step = [x2 - x1, y2 - y1];
     if (
       this.canCapture &&
-      ( // TODO...........
-        this.onBoard(x1 - step[0], y1 - step[1]) &&
+      (
+        !this.onBoard(x1 - step[0], y1 - step[1]) ||
+        this.board[x1 - step[0]][y1 - step[1]] == ""
+      )
+      &&
+      (
+        !this.onBoard(x1 + step[0], y1 + step[1]) ||
+        this.board[x1 + step[0]][y1 + step[1]] == ""
+      )
+    ) {
+      return [];
+    }
+    // Ok, the move seems valid
     let moves = [];
-
+////////// TODO ?????????
   }
 
   atLeastOneCapture() {