Some improvements. Testing variants: Baroque has some issues
authorBenjamin Auder <benjamin.auder@somewhere>
Sat, 28 Jan 2023 20:42:02 +0000 (21:42 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Sat, 28 Jan 2023 20:42:02 +0000 (21:42 +0100)
72 files changed:
base_rules.js
pieces/Alapo/black_CIRCLE.svg [moved from variants/Alapo/pieces/black_CIRCLE.svg with 100% similarity]
pieces/Alapo/black_SQUARE.svg [moved from variants/Alapo/pieces/black_SQUARE.svg with 100% similarity]
pieces/Alapo/black_TRIANGLE.svg [moved from variants/Alapo/pieces/black_TRIANGLE.svg with 100% similarity]
pieces/Alapo/black_TRIANGLE_inv.svg [moved from variants/Alapo/pieces/black_TRIANGLE_inv.svg with 100% similarity]
pieces/Alapo/black_circle.svg [moved from variants/Alapo/pieces/black_circle.svg with 100% similarity]
pieces/Alapo/black_square.svg [moved from variants/Alapo/pieces/black_square.svg with 100% similarity]
pieces/Alapo/black_triangle.svg [moved from variants/Alapo/pieces/black_triangle.svg with 100% similarity]
pieces/Alapo/black_triangle_inv.svg [moved from variants/Alapo/pieces/black_triangle_inv.svg with 100% similarity]
pieces/Alapo/white_CIRCLE.svg [moved from variants/Alapo/pieces/white_CIRCLE.svg with 100% similarity]
pieces/Alapo/white_SQUARE.svg [moved from variants/Alapo/pieces/white_SQUARE.svg with 100% similarity]
pieces/Alapo/white_TRIANGLE.svg [moved from variants/Alapo/pieces/white_TRIANGLE.svg with 100% similarity]
pieces/Alapo/white_TRIANGLE_inv.svg [moved from variants/Alapo/pieces/white_TRIANGLE_inv.svg with 100% similarity]
pieces/Alapo/white_circle.svg [moved from variants/Alapo/pieces/white_circle.svg with 100% similarity]
pieces/Alapo/white_square.svg [moved from variants/Alapo/pieces/white_square.svg with 100% similarity]
pieces/Alapo/white_triangle.svg [moved from variants/Alapo/pieces/white_triangle.svg with 100% similarity]
pieces/Alapo/white_triangle_inv.svg [moved from variants/Alapo/pieces/white_triangle_inv.svg with 100% similarity]
pieces/Ambiguous/red_target.svg [moved from variants/Ambiguous/pieces/red_target.svg with 100% similarity]
pieces/Ambiguous/yellow_target.svg [moved from variants/Ambiguous/pieces/yellow_target.svg with 100% similarity]
pieces/Avalam/generateSVG.py [moved from variants/Avalam/pieces/generateSVG.py with 100% similarity]
pieces/Balaklava/CREDITS [moved from variants/Balaklava/pieces/CREDITS with 100% similarity]
pieces/Balaklava/black_mammoth.svg [moved from variants/Balaklava/pieces/black_mammoth.svg with 100% similarity]
pieces/Balaklava/white_mammoth.svg [moved from variants/Balaklava/pieces/white_mammoth.svg with 100% similarity]
pieces/Baroque/black_immobilizer.svg [moved from variants/Baroque/pieces/black_immobilizer.svg with 100% similarity]
pieces/Baroque/white_immobilizer.svg [moved from variants/Baroque/pieces/white_immobilizer.svg with 100% similarity]
pieces/Benedict/CREDITS [moved from variants/Benedict/pieces/CREDITS with 100% similarity]
pieces/Benedict/black_cleopatra.svg [moved from variants/Benedict/pieces/black_cleopatra.svg with 100% similarity]
pieces/Benedict/black_cleopatra_TODO.svg [moved from variants/Benedict/pieces/black_cleopatra_TODO.svg with 100% similarity]
pieces/Benedict/white_cleopatra.svg [moved from variants/Benedict/pieces/white_cleopatra.svg with 100% similarity]
pieces/Benedict/white_cleopatra_TODO.svg [moved from variants/Benedict/pieces/white_cleopatra_TODO.svg with 100% similarity]
pieces/Chakart/CREDITS [moved from variants/Chakart/pieces/CREDITS with 100% similarity]
pieces/Chakart/banana.svg [moved from variants/Chakart/pieces/banana.svg with 100% similarity]
pieces/Chakart/bomb.svg [moved from variants/Chakart/pieces/bomb.svg with 100% similarity]
pieces/Chakart/egg.svg [moved from variants/Chakart/pieces/egg.svg with 100% similarity]
pieces/Chakart/mushroom.svg [moved from variants/Chakart/pieces/mushroom.svg with 100% similarity]
pieces/Chakart/shell.svg [moved from variants/Chakart/pieces/shell.svg with 100% similarity]
pieces/Checkered/cb.svg [moved from variants/Checkered/pieces/cb.svg with 100% similarity]
pieces/Checkered/cn.svg [moved from variants/Checkered/pieces/cn.svg with 100% similarity]
pieces/Checkered/cp.svg [moved from variants/Checkered/pieces/cp.svg with 100% similarity]
pieces/Checkered/cq.svg [moved from variants/Checkered/pieces/cq.svg with 100% similarity]
pieces/Checkered/cr.svg [moved from variants/Checkered/pieces/cr.svg with 100% similarity]
pieces/Weiqi/CREDITS [moved from variants/Weiqi/pieces/CREDITS with 100% similarity]
pieces/Weiqi/black_stone.svg [moved from variants/Weiqi/pieces/black_stone.svg with 100% similarity]
pieces/Weiqi/white_stone.svg [moved from variants/Weiqi/pieces/white_stone.svg with 100% similarity]
pieces/_Antiking/black_antiking.svg [moved from variants/_Antiking/pieces/black_antiking.svg with 100% similarity]
pieces/_Antiking/white_antiking.svg [moved from variants/_Antiking/pieces/white_antiking.svg with 100% similarity]
pieces/_Berolina/CREDITS [moved from variants/_Berolina/pieces/CREDITS with 100% similarity]
pieces/_Berolina/black_pawn.svg [moved from variants/_Berolina/pieces/black_pawn.svg with 100% similarity]
pieces/_Berolina/white_pawn.svg [moved from variants/_Berolina/pieces/white_pawn.svg with 100% similarity]
pieces/_SpecialCaptures/CREDITS [moved from variants/_SpecialCaptures/pieces/CREDITS with 100% similarity]
pieces/_SpecialCaptures/capture_pull.svg [moved from variants/_SpecialCaptures/pieces/capture_pull.svg with 100% similarity]
pieces/_SpecialCaptures/capture_push.svg [moved from variants/_SpecialCaptures/pieces/capture_push.svg with 100% similarity]
variants.js
variants/Alapo/style.css
variants/Atarigo/class.js
variants/Avalam/class.js
variants/Avalam/pieces/.gitignore [deleted file]
variants/Avalam/style.css
variants/Avalanche/class.js
variants/Avalanche/rules.html
variants/Balaklava/class.js
variants/Balaklava/style.css
variants/Baroque/class.js
variants/Baroque/style.css
variants/Benedict/style.css
variants/Chakart/style.css
variants/Checkered/style.css
variants/Weiqi/style.css
variants/_Antiking/style.css
variants/_Berolina/style.css
variants/_SpecialCaptures/class.js
variants/_SpecialCaptures/style.css

index a8dad15..85666e2 100644 (file)
@@ -2320,7 +2320,7 @@ export default class ChessRules {
 
   tryChangeTurn(move) {
     if (this.isLastMove(move)) {
 
   tryChangeTurn(move) {
     if (this.isLastMove(move)) {
-      this.turn = (this.turn == 'w' ? 'b' : 'w');
+      this.turn = C.GetOppTurn(this.turn);
       this.movesCount++;
       this.subTurn = 1;
     }
       this.movesCount++;
       this.subTurn = 1;
     }
@@ -2406,7 +2406,8 @@ export default class ChessRules {
 
   playVisual(move, r) {
     move.vanish.forEach(v => {
 
   playVisual(move, r) {
     move.vanish.forEach(v => {
-      this.g_pieces[v.x][v.y].remove();
+      if (this.g_pieces[v.x][v.y]) //can be null (e.g. Apocalypse)
+        this.g_pieces[v.x][v.y].remove();
       this.g_pieces[v.x][v.y] = null;
     });
     let chessboard =
       this.g_pieces[v.x][v.y] = null;
     });
     let chessboard =
@@ -2475,6 +2476,10 @@ export default class ChessRules {
 
   animateMoving(start, end, drag, segments, cb) {
     let initPiece = this.getDomPiece(start.x, start.y);
 
   animateMoving(start, end, drag, segments, cb) {
     let initPiece = this.getDomPiece(start.x, start.y);
+    if (!initPiece) { //TODO: shouldn't occur!
+      cb();
+      return;
+    }
     // NOTE: cloning often not required, but light enough, and simpler
     let movingPiece = initPiece.cloneNode();
     initPiece.style.opacity = "0";
     // NOTE: cloning often not required, but light enough, and simpler
     let movingPiece = initPiece.cloneNode();
     initPiece.style.opacity = "0";
index ef297b6..73af2c7 100644 (file)
@@ -15,8 +15,8 @@ const variants = [
   {name: 'Avalam', desc: 'Build towers'},
   {name: 'Avalanche', desc: 'Pawnfalls'},
   {name: 'Balaklava', desc: 'Meet the Mammoth'},
   {name: 'Avalam', desc: 'Build towers'},
   {name: 'Avalanche', desc: 'Pawnfalls'},
   {name: 'Balaklava', desc: 'Meet the Mammoth'},
+  {name: "Balanced", desc: "Balanced chess"},
   {name: 'Bario', desc: 'A quantum story'},
   {name: 'Bario', desc: 'A quantum story'},
-  {name: "Balanced", desc: "balanced chess"},
   {name: 'Baroque', desc: 'Exotic captures'},
   {name: "Benedict", desc: "Change colors"},
   {name: 'Berolina', desc: 'Pawns move diagonally'},
   {name: 'Baroque', desc: 'Exotic captures'},
   {name: "Benedict", desc: "Change colors"},
   {name: 'Berolina', desc: 'Pawns move diagonally'},
index 7a18a55..4fbefb1 100644 (file)
@@ -1,49 +1,49 @@
 piece.black.rook {
 piece.black.rook {
-  background-image: url('/variants/Alapo/pieces/black_SQUARE.svg');
+  background-image: url('/pieces/Alapo/black_SQUARE.svg');
 }
 piece.black.bishop {
 }
 piece.black.bishop {
-  background-image: url('/variants/Alapo/pieces/black_TRIANGLE.svg');
+  background-image: url('/pieces/Alapo/black_TRIANGLE.svg');
 }
 piece.black.bishop_inv {
 }
 piece.black.bishop_inv {
-  background-image: url('/variants/Alapo/pieces/black_TRIANGLE_inv.svg');
+  background-image: url('/pieces/Alapo/black_TRIANGLE_inv.svg');
 }
 piece.black.queen {
 }
 piece.black.queen {
-  background-image: url('/variants/Alapo/pieces/black_CIRCLE.svg');
+  background-image: url('/pieces/Alapo/black_CIRCLE.svg');
 }
 piece.black.babyrook {
 }
 piece.black.babyrook {
-  background-image: url('/variants/Alapo/pieces/black_square.svg');
+  background-image: url('/pieces/Alapo/black_square.svg');
 }
 piece.black.babybishop {
 }
 piece.black.babybishop {
-  background-image: url('/variants/Alapo/pieces/black_triangle.svg');
+  background-image: url('/pieces/Alapo/black_triangle.svg');
 }
 piece.black.babybishop_inv {
 }
 piece.black.babybishop_inv {
-  background-image: url('/variants/Alapo/pieces/black_triangle_inv.svg');
+  background-image: url('/pieces/Alapo/black_triangle_inv.svg');
 }
 piece.black.babyqueen {
 }
 piece.black.babyqueen {
-  background-image: url('/variants/Alapo/pieces/black_circle.svg');
+  background-image: url('/pieces/Alapo/black_circle.svg');
 }
 
 piece.white.rook {
 }
 
 piece.white.rook {
-  background-image: url('/variants/Alapo/pieces/white_SQUARE.svg');
+  background-image: url('/pieces/Alapo/white_SQUARE.svg');
 }
 piece.white.bishop {
 }
 piece.white.bishop {
-  background-image: url('/variants/Alapo/pieces/white_TRIANGLE.svg');
+  background-image: url('/pieces/Alapo/white_TRIANGLE.svg');
 }
 piece.white.bishop_inv {
 }
 piece.white.bishop_inv {
-  background-image: url('/variants/Alapo/pieces/white_TRIANGLE_inv.svg');
+  background-image: url('/pieces/Alapo/white_TRIANGLE_inv.svg');
 }
 piece.white.queen {
 }
 piece.white.queen {
-  background-image: url('/variants/Alapo/pieces/white_CIRCLE.svg');
+  background-image: url('/pieces/Alapo/white_CIRCLE.svg');
 }
 piece.white.babyrook {
 }
 piece.white.babyrook {
-  background-image: url('/variants/Alapo/pieces/white_square.svg');
+  background-image: url('/pieces/Alapo/white_square.svg');
 }
 piece.white.babybishop {
 }
 piece.white.babybishop {
-  background-image: url('/variants/Alapo/pieces/white_triangle.svg');
+  background-image: url('/pieces/Alapo/white_triangle.svg');
 }
 piece.white.babybishop_inv {
 }
 piece.white.babybishop_inv {
-  background-image: url('/variants/Alapo/pieces/white_triangle_inv.svg');
+  background-image: url('/pieces/Alapo/white_triangle_inv.svg');
 }
 piece.white.babyqueen {
 }
 piece.white.babyqueen {
-  background-image: url('/variants/Alapo/pieces/white_circle.svg');
+  background-image: url('/pieces/Alapo/white_circle.svg');
 }
 }
index 25873aa..1b848c9 100644 (file)
@@ -1,4 +1,4 @@
-import GoRules from "/variants/Weiqi/class.js";
+import WeiqiRules from "/variants/Weiqi/class.js";
 import Move from "/utils/Move.js";
 import PiPo from "/utils/PiPo.js";
 import {ArrayFun} from "/utils/array.js";
 import Move from "/utils/Move.js";
 import PiPo from "/utils/PiPo.js";
 import {ArrayFun} from "/utils/array.js";
index aaa2cf3..5fe5ed3 100644 (file)
@@ -156,7 +156,7 @@ export default class AvalamRules extends ChessRules {
     if (height == 5)
       return [];
     let moves = [];
     if (height == 5)
       return [];
     let moves = [];
-    for (let s of this.pieces()['b'].moves[0].steps) {
+    for (let s of this.pieces(this.turn, x, y)['b'].both[0].steps) {
       const [i, j] = [x + s[0], y + s[1]];
       if (
         this.onBoard(i, j) &&
       const [i, j] = [x + s[0], y + s[1]];
       if (
         this.onBoard(i, j) &&
diff --git a/variants/Avalam/pieces/.gitignore b/variants/Avalam/pieces/.gitignore
deleted file mode 100644 (file)
index 756b22f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-*.svg
index ed6279c..04463d1 100644 (file)
@@ -1,33 +1,33 @@
 piece.white.stack {
 piece.white.stack {
-  background-image: url('/variants/Avalam/pieces/white_stack.svg');
+  background-image: url('/pieces/Avalam/white_stack.svg');
 }
 piece.white.stack2 {
 }
 piece.white.stack2 {
-  background-image: url('/variants/Avalam/pieces/white_stack2.svg');
+  background-image: url('/pieces/Avalam/white_stack2.svg');
 }
 piece.white.stack3 {
 }
 piece.white.stack3 {
-  background-image: url('/variants/Avalam/pieces/white_stack3.svg');
+  background-image: url('/pieces/Avalam/white_stack3.svg');
 }
 piece.white.stack4 {
 }
 piece.white.stack4 {
-  background-image: url('/variants/Avalam/pieces/white_stack4.svg');
+  background-image: url('/pieces/Avalam/white_stack4.svg');
 }
 piece.white.stack5 {
 }
 piece.white.stack5 {
-  background-image: url('/variants/Avalam/pieces/white_stack5.svg');
+  background-image: url('/pieces/Avalam/white_stack5.svg');
 }
 
 piece.black.stack {
 }
 
 piece.black.stack {
-  background-image: url('/variants/Avalam/pieces/black_stack.svg');
+  background-image: url('/pieces/Avalam/black_stack.svg');
 }
 piece.black.stack2 {
 }
 piece.black.stack2 {
-  background-image: url('/variants/Avalam/pieces/black_stack2.svg');
+  background-image: url('/pieces/Avalam/black_stack2.svg');
 }
 piece.black.stack3 {
 }
 piece.black.stack3 {
-  background-image: url('/variants/Avalam/pieces/black_stack3.svg');
+  background-image: url('/pieces/Avalam/black_stack3.svg');
 }
 piece.black.stack4 {
 }
 piece.black.stack4 {
-  background-image: url('/variants/Avalam/pieces/black_stack4.svg');
+  background-image: url('/pieces/Avalam/black_stack4.svg');
 }
 piece.black.stack5 {
 }
 piece.black.stack5 {
-  background-image: url('/variants/Avalam/pieces/black_stack5.svg');
+  background-image: url('/pieces/Avalam/black_stack5.svg');
 }
 
 .board-sq {
 }
 
 .board-sq {
index dbbe9d5..ee80550 100644 (file)
@@ -7,6 +7,14 @@ export default class AvalancheRules extends ChessRules {
   static get Options() {
     return {
       select: C.Options.select,
   static get Options() {
     return {
       select: C.Options.select,
+      input: [
+        {
+          label: "Balanced",
+          variable: "balanced",
+          type: "checkbox",
+          defaut: false
+        }
+      ],
       styles: [
         "atomic",
         "cannibal",
       styles: [
         "atomic",
         "cannibal",
@@ -116,35 +124,46 @@ export default class AvalancheRules extends ChessRules {
     return false;
   }
 
     return false;
   }
 
-  postPlay(move) {
+  tryChangeTurn(move) {
     const color = this.turn;
     const oppCol = C.GetOppTurn(color);
     const color = this.turn;
     const oppCol = C.GetOppTurn(color);
-    this.promotion = (
-      this.subTurn == 2 &&
-      move.end.x == (oppCol == 'w' ? 0 : this.size.x - 1) &&
-      move.vanish[0].p == 'p'
-    );
-    if (this.subTurn == 0) {
-      this.subTurn++;
-      if (!this.atLeastOneMove(color)) {
-        move.result = "1/2"; //avoid re-computation
-        this.turn = oppCol;
+    const incrementTurn = () => {
+      if (this.options["balanced"] && this.movesCount == 0) {
+        // No pawn push on move 1:
+        return true;
       }
       }
-    }
-    else if (this.subTurn == 2) {
-      this.turn = oppCol;
-      this.subTurn = this.promotion ? 0 : 1;
-    }
-    else { //subTurn == 1, usual case
+      this.promotion = (
+        this.subTurn == 2 &&
+        move.end.x == (oppCol == 'w' ? 0 : this.size.x - 1) &&
+        move.vanish[0].p == 'p'
+      );
+      if (this.subTurn == 0) {
+        this.subTurn++;
+        if (!this.atLeastOneMove(color)) {
+          move.result = "1/2"; //avoid re-computation
+          return true;
+        }
+        return false;
+      }
+      if (this.subTurn == 2) {
+        this.subTurn = (this.promotion ? 0 : 1);
+        return true;
+      }
+      // subTurn == 1, usual case
       const kingCapture = this.searchKingPos(oppCol).length == 0;
       if (kingCapture)
         move.result = (color == 'w' ? "1-0" : "0-1");
       const kingCapture = this.searchKingPos(oppCol).length == 0;
       if (kingCapture)
         move.result = (color == 'w' ? "1-0" : "0-1");
-      if (!kingCapture && this.atLeastOnePawnPush(oppCol))
-        this.subTurn++;
-      else {
-        this.turn = oppCol;
-        this.subTurn = this.promotion ? 0 : 1;
+      if (kingCapture || !this.atLeastOnePawnPush(oppCol)) {
+        this.subTurn = (this.promotion ? 0 : 1);
+        return true;
       }
       }
+      // A pawn push is possible: usual case
+      this.subTurn++;
+      return false;
+    };
+    if (incrementTurn()) {
+      this.turn = oppCol;
+      this.movesCount++;
     }
   }
 
     }
   }
 
index a25d2cf..b8bb255 100644 (file)
@@ -1,6 +1,7 @@
 <p>
   After each normal move, push an opponent pawn one square forward.
   If the pawn promotes, its owner will select into which piece on next turn.
 <p>
   After each normal move, push an opponent pawn one square forward.
   If the pawn promotes, its owner will select into which piece on next turn.
+  In balanced Avalanche, white has no pawn push at the first move.
 </p>
 
 <p>The goal is either to checkmate or to capture the enemy king.</p>
 </p>
 
 <p>The goal is either to checkmate or to capture the enemy king.</p>
index 0e7b72f..1ee2dd7 100644 (file)
@@ -13,7 +13,7 @@ export default class BalaklavaRules extends ChessRules {
 
   pieces(color, x, y) {
     let res = super.pieces(color, x, y);
 
   pieces(color, x, y) {
     let res = super.pieces(color, x, y);
-    const knightSpec = res['n'];
+    const knightSpecMoves = res['n'].both;
     delete res['n'];
     res['m'] = {
       "class": "mammoth",
     delete res['n'];
     res['m'] = {
       "class": "mammoth",
@@ -28,7 +28,11 @@ export default class BalaklavaRules extends ChessRules {
         }
       ]
     };
         }
       ]
     };
-    ['p', 'r', 'b', 'm', 'q'].forEach(p => res[p].moves = knightSpec.moves);
+    ['p', 'r', 'b', 'm', 'q'].forEach(p => {
+      if (!res[p].moves)
+        res[p].moves = [];
+      Array.prototype.push.apply(res[p].moves, knightSpecMoves);
+    });
     return res;
   }
 
     return res;
   }
 
@@ -43,7 +47,7 @@ export default class BalaklavaRules extends ChessRules {
     return {
       fen: s.b.join("") + "/pppppppp/8/8/8/8/PPPPPPPP/" +
            s.w.join("").toUpperCase(),
     return {
       fen: s.b.join("") + "/pppppppp/8/8/8/8/PPPPPPPP/" +
            s.w.join("").toUpperCase(),
-      o: {}
+      o: {flags: s.flags}
     };
   }
 
     };
   }
 
index c876806..f44a5b6 100644 (file)
@@ -1,8 +1,8 @@
 @import url("/base_pieces.css");
 
 piece.white.mammoth {
 @import url("/base_pieces.css");
 
 piece.white.mammoth {
-  background-image: url('/variants/Balaklava/pieces/white_mammoth.svg');
+  background-image: url('/pieces/Balaklava/white_mammoth.svg');
 }
 piece.black.mammoth {
 }
 piece.black.mammoth {
-  background-image: url('/variants/Balaklava/pieces/black_mammoth.svg');
+  background-image: url('/pieces/Balaklava/black_mammoth.svg');
 }
 }
index 6434e05..84331a2 100644 (file)
@@ -1,4 +1,4 @@
-import AbstractSpecialCaptureRules from "/variants/_SpecialCaptures.js";
+import AbstractSpecialCaptureRules from "/variants/_SpecialCaptures/class.js";
 import {FenUtil} from "/utils/setupPieces.js";
 import {Random} from "/utils/alea.js";
 
 import {FenUtil} from "/utils/setupPieces.js";
 import {Random} from "/utils/alea.js";
 
@@ -100,7 +100,7 @@ export default class BaroqueRules extends AbstractSpecialCaptureRules {
     const piece = this.getPiece(x, y);
     const color = this.getColor(x, y);
     const oppCol = C.GetOppTurn(color);
     const piece = this.getPiece(x, y);
     const color = this.getColor(x, y);
     const oppCol = C.GetOppTurn(color);
-    const adjacentSteps = this.pieces()['k'].moves[0].steps;
+    const adjacentSteps = this.pieces()['k'].both[0].steps;
     for (let step of adjacentSteps) {
       const [i, j] = [x + step[0], this.getY(y + step[1])];
       if (
     for (let step of adjacentSteps) {
       const [i, j] = [x + step[0], this.getY(y + step[1])];
       if (
index 12550dc..d35931f 100644 (file)
@@ -2,8 +2,8 @@
 @import url("/variants/_SpecialCaptures/style.css");
 
 piece.white.immobilizer {
 @import url("/variants/_SpecialCaptures/style.css");
 
 piece.white.immobilizer {
-  background-image: url('/variants/Baroque/pieces/white_immobilizer.svg');
+  background-image: url('/pieces/Baroque/white_immobilizer.svg');
 }
 piece.black.immobilizer {
 }
 piece.black.immobilizer {
-  background-image: url('/variants/Baroque/pieces/black_immobilizer.svg');
+  background-image: url('/pieces/Baroque/black_immobilizer.svg');
 }
 }
index 31e16b6..1cb0afd 100644 (file)
@@ -1,8 +1,8 @@
 @import url("/base_pieces.css");
 
 piece.black.cleopatra {
 @import url("/base_pieces.css");
 
 piece.black.cleopatra {
-  background-image: url('/variants/Benedict/pieces/black_cleopatra.svg');
+  background-image: url('/pieces/Benedict/black_cleopatra.svg');
 }
 piece.white.cleopatra {
 }
 piece.white.cleopatra {
-  background-image: url('/variants/Benedict/pieces/white_cleopatra.svg');
+  background-image: url('/pieces/Benedict/white_cleopatra.svg');
 }
 }
index 819fe51..6f45bed 100644 (file)
@@ -1,19 +1,19 @@
 @import url("/base_pieces.css");
 
 piece.egg {
 @import url("/base_pieces.css");
 
 piece.egg {
-  background-image: url('/variants/Chakart/pieces/egg.svg');
+  background-image: url('/pieces/Chakart/egg.svg');
 }
 
 piece.mushroom {
 }
 
 piece.mushroom {
-  background-image: url('/variants/Chakart/pieces/mushroom.svg');
+  background-image: url('/pieces/Chakart/mushroom.svg');
 }
 
 piece.banana {
 }
 
 piece.banana {
-  background-image: url('/variants/Chakart/pieces/banana.svg');
+  background-image: url('/pieces/Chakart/banana.svg');
 }
 
 piece.bomb {
 }
 
 piece.bomb {
-  background-image: url('/variants/Chakart/pieces/bomb.svg');
+  background-image: url('/pieces/Chakart/bomb.svg');
 }
 
 piece.white.invisible {
 }
 
 piece.white.invisible {
@@ -29,7 +29,7 @@ piece.immobilized {
 }
 
 piece.remote-capture {
 }
 
 piece.remote-capture {
-  background-image: url('/variants/Chakart/pieces/shell.svg');
+  background-image: url('/pieces/Chakart/shell.svg');
 }
 
 piece.white.mystery {
 }
 
 piece.white.mystery {
index c103c25..89dad8d 100644 (file)
@@ -1,19 +1,19 @@
 @import url("/base_pieces.css");
 
 piece.checkered.pawn {
 @import url("/base_pieces.css");
 
 piece.checkered.pawn {
-  background-image: url('/variants/Checkered/pieces/cp.svg');
+  background-image: url('/pieces/Checkered/cp.svg');
 }
 piece.checkered.rook {
 }
 piece.checkered.rook {
-  background-image: url('/variants/Checkered/pieces/cr.svg');
+  background-image: url('/pieces/Checkered/cr.svg');
 }
 piece.checkered.knight {
 }
 piece.checkered.knight {
-  background-image: url('/variants/Checkered/pieces/cn.svg');
+  background-image: url('/pieces/Checkered/cn.svg');
 }
 piece.checkered.bishop {
 }
 piece.checkered.bishop {
-  background-image: url('/variants/Checkered/pieces/cb.svg');
+  background-image: url('/pieces/Checkered/cb.svg');
 }
 piece.checkered.queen {
 }
 piece.checkered.queen {
-  background-image: url('/variants/Checkered/pieces/cq.svg');
+  background-image: url('/pieces/Checkered/cq.svg');
 }
 
 div.info-text {
 }
 
 div.info-text {
index 54b9a40..85e5712 100644 (file)
@@ -3,10 +3,10 @@
 }
 
 piece.white.stone {
 }
 
 piece.white.stone {
-  background-image: url('/variants/Weiqi/pieces/black_stone.svg');
+  background-image: url('/pieces/Weiqi/black_stone.svg');
 }
 piece.black.stone, piece.white.stone.one-color {
 }
 piece.black.stone, piece.white.stone.one-color {
-  background-image: url('/variants/Weiqi/pieces/white_stone.svg');
+  background-image: url('/pieces/Weiqi/white_stone.svg');
 }
 
 button.pass-btn {
 }
 
 button.pass-btn {
index cdbab55..6614062 100644 (file)
@@ -1,8 +1,8 @@
 @import url("/base_pieces.css");
 
 piece.black.antiking {
 @import url("/base_pieces.css");
 
 piece.black.antiking {
-  background-image: url('/variants/_Antiking/pieces/black_antiking.svg');
+  background-image: url('/pieces/_Antiking/black_antiking.svg');
 }
 piece.white.antiking {
 }
 piece.white.antiking {
-  background-image: url('/variants/_Antiking/pieces/white_antiking.svg');
+  background-image: url('/pieces/_Antiking/white_antiking.svg');
 }
 }
index 4daa2c8..8a148c4 100644 (file)
@@ -1,6 +1,6 @@
 piece.black.pawn {
 piece.black.pawn {
-  background-image: url('/variants/_Berolina/pieces/black_pawn.svg');
+  background-image: url('/pieces/_Berolina/black_pawn.svg');
 }
 piece.white.pawn {
 }
 piece.white.pawn {
-  background-image: url('/variants/_Berolina/pieces/white_pawn.svg');
+  background-image: url('/pieces/_Berolina/white_pawn.svg');
 }
 }
index e6a0db1..0c2a300 100644 (file)
@@ -112,7 +112,7 @@ export default class AbstractSpecialCaptureRules extends ChessRules {
         [i, j] = [i + step[0], this.getY(j + step[1])];
         while (this.onBoard(i, j) && this.board[i][j] == "") {
           let mv = this.getBasicMove([x, y], [i, j]);
         [i, j] = [i + step[0], this.getY(j + step[1])];
         while (this.onBoard(i, j) && this.board[i][j] == "") {
           let mv = this.getBasicMove([x, y], [i, j]);
-          Array.prorotype.push.apply(mv.vanish, vanished);
+          Array.prototype.push.apply(mv.vanish, vanished);
           moves.push(mv);
           [i, j] = [i + step[0], this.getY(j + step[1])];
         }
           moves.push(mv);
           [i, j] = [i + step[0], this.getY(j + step[1])];
         }
@@ -133,7 +133,7 @@ export default class AbstractSpecialCaptureRules extends ChessRules {
   getChameleonCaptures(moves, pushPullType, onlyOneJump) {
     const [x, y] = [moves[0].start.x, moves[0].start.y];
     moves = moves.concat(
   getChameleonCaptures(moves, pushPullType, onlyOneJump) {
     const [x, y] = [moves[0].start.x, moves[0].start.y];
     moves = moves.concat(
-      this.getKnightCaptures([x, y], "asChameleon", onlyOneJump));
+      this.getLeaperCaptures([x, y], "asChameleon", onlyOneJump));
     // No "king capture" because king cannot remain under check
     this.addPincerCaptures(moves, "asChameleon");
     this.addCoordinatorCaptures(moves, "asChameleon");
     // No "king capture" because king cannot remain under check
     this.addPincerCaptures(moves, "asChameleon");
     this.addCoordinatorCaptures(moves, "asChameleon");
@@ -177,8 +177,8 @@ export default class AbstractSpecialCaptureRules extends ChessRules {
     moves.forEach(m => {
       const [ex, ey] = [m.end.x, m.end.y];
       const step = [
     moves.forEach(m => {
       const [ex, ey] = [m.end.x, m.end.y];
       const step = [
-        ex != x ? (ex - x) / Math.abs(ex - x) : 0,
-        ey != y ? (ey - y) / Math.abs(ey - y) : 0
+        ex != sx ? (ex - sx) / Math.abs(ex - sx) : 0,
+        ey != sy ? (ey - sy) / Math.abs(ey - sy) : 0
       ];
       let vanishPull, vanishPush;
       if (type != "pull") {
       ];
       let vanishPull, vanishPush;
       if (type != "pull") {
@@ -194,7 +194,7 @@ export default class AbstractSpecialCaptureRules extends ChessRules {
         }
       }
       if (capturingPullDir[step[0] + "." + step[1]]) {
         }
       }
       if (capturingPullDir[step[0] + "." + step[1]]) {
-        const [bi, bj] = [x - step[0], this.getY(y - step[1])];
+        const [bi, bj] = [sx - step[0], this.getY(sy - step[1])];
         vanishPull =
           new PiPo({x: bi, y: bj, p: this.getPiece(bi, bj), c: oppCol});
       }
         vanishPull =
           new PiPo({x: bi, y: bj, p: this.getPiece(bi, bj), c: oppCol});
       }
index 3360267..2a8c527 100644 (file)
@@ -1,6 +1,6 @@
 .piece.white.push-action {
 .piece.white.push-action {
-  background-image: url('/variants/_SpecialCaptures/pieces/capture_push.svg');
+  background-image: url('/pieces/_SpecialCaptures/capture_push.svg');
 }
 .piece.white.pull-action {
 }
 .piece.white.pull-action {
-  background-image: url('/variants/_SpecialCaptures/pieces/capture_pull.svg');
+  background-image: url('/pieces/_SpecialCaptures/capture_pull.svg');
 }
 }