From: Benjamin Auder <benjamin.auder@somewhere>
Date: Thu, 28 Jul 2022 00:03:08 +0000 (+0200)
Subject: Fix Balaklava, draft Bario complete rules
X-Git-Url: https://git.auder.net/doc/html/pieces/img/vendor/%24%7BgetWhatsApp%28link%29%7D?a=commitdiff_plain;h=0437a28b7e71bf8eb72fdab83b04ba98996393ec;p=xogo.git

Fix Balaklava, draft Bario complete rules
---

diff --git a/variants/Balaklava/class.js b/variants/Balaklava/class.js
index e16322f..2922b02 100644
--- a/variants/Balaklava/class.js
+++ b/variants/Balaklava/class.js
@@ -27,7 +27,7 @@ export default class BalaklavaRules extends ChessRules {
         }
       ]
     };
-    ['r', 'b', 'm', 'q'].forEach(p => res[p].moves = knightSpec.moves);
+    ['p', 'r', 'b', 'm', 'q'].forEach(p => res[p].moves = knightSpec.moves);
     return res;
   }
 
@@ -44,12 +44,16 @@ export default class BalaklavaRules extends ChessRules {
       return [];
     const color = moves[0].vanish[0].c;
     const lastRank = (color == 'w' ? 0 : this.size.x - 1);
+    const forward = (color == 'w' ? -1 : 1);
     const noKnightPromotions = moves.filter(m => {
       return (
-        m.end.x != lastRank ||
+        (m.end.x - m.start.x) * forward > 0 &&
         (
-          Math.abs(m.start.x - m.end.x) <= 1 &&
-          Math.abs(m.start.y - m.end.y) <= 1
+          m.end.x != lastRank ||
+          (
+            Math.abs(m.start.x - m.end.x) <= 1 &&
+            Math.abs(m.start.y - m.end.y) <= 1
+          )
         )
       );
     });
diff --git a/variants/Balaklava/rules.html b/variants/Balaklava/rules.html
index c65158e..97c96a6 100644
--- a/variants/Balaklava/rules.html
+++ b/variants/Balaklava/rules.html
@@ -1 +1,17 @@
-<p>TODO</p>
+<p>
+  In addition to their usual abilities, pawns and non-royal pieces (everything
+  but the king) may make non-capturing knight moves.
+  The Mammoth can leap two squares in any direction.
+  Pawns move forward only.
+</p>
+
+<ul>
+  <li>A pawn cannot promote with a knight move.</li>
+  <li>No en passant captures.</li>
+</ul>
+
+<a href="https://www.chessvariants.com/diffmove.dir/balaklava.html">
+  chessvariants page.
+</a>
+
+<p class="author">Gianluca Vecchi (1994).</p>
diff --git a/variants/Bario/complete_rules.html b/variants/Bario/complete_rules.html
new file mode 100644
index 0000000..93ecc9d
--- /dev/null
+++ b/variants/Bario/complete_rules.html
@@ -0,0 +1,64 @@
+p.boxed
+  | Your pieces remain in an undefined state until they are moved.
+
+p
+  | Bario is a chess variant invented by Panos Louridas in 1998. 
+  a(href="https://www.bario-chess-checkers-chessphotography-spaceart.de/")
+    | His website
+  | &nbsp;contains many examples and explanations.
+  | See also the discussion 
+  a(href="https://www.chessvariants.com/index/listcomments.php?order=DESC&itemid=Bario")
+    | on chessvariants.com
+  | .
+
+figure
+  img.img-center(src="/variants/Bario/chessboard2.jpg" style="width:75%")
+  figcaption.text-center.
+    [With author's permission]
+    Undefined pieces on first ranks.
+
+p.
+  Queens, rooks, bishops and knights begin the game in a reserve below
+  the board, because their location isn't determined yet.
+  At each turn, you can either move something already defined on the board, or
+ol
+  li move a piece from your reserve to any question mark, and then
+  li move the now defined piece on the board.
+
+p An undefined piece gives check if some specialization giving check exists.
+
+figure.diagram-container
+  .diagram
+    | fen:uuuuu1uk/p2p1qp1/1p6/7p/7P/5N2/PP1P1PP1/UUUKU1UU:
+  figcaption The white king cannot move, a rook might be on c8 or e8
+
+h4 Details, special cases
+
+p.
+  At the first move, you must select a square for the king anywhere on
+  the first rank &mdash; preferably in a corner. This deviates from the
+  original intention of the author, but this way you will not need to castle
+  later in the game. Click on a square to place the king.
+
+p.
+  If after your move all your pieces are defined (and weren't before), then
+  all pieces on board revert to undefined state, unless:
+ul
+  li.
+    all your pieces (board + reserve) are now of the same type,
+    in which case none is put back in reserve, or
+  li.
+    all opponent's pieces are of the same type, in which case
+    they also remain defined.
+
+figure.diagram-container
+  .diagram.diag12
+    | fen:uuu1kuuu/2p5/2n5/1p1ppppp/p4PPP/3N3Q/PPPPP1BB/1RRUK3:
+  .diagram.diag22
+    | fen:uuu1kuuu/2p5/2u5/1p1ppppp/p4PPP/3UU2U/PPPPP1UU/1UU1K3:
+  figcaption.
+    Before and after knight definition on d1 (moving to e3)
+
+p.
+  If one of your undefined pieces is captured, you first have to choose which
+  one was captured from the reserve: place it at the capture location.
diff --git a/variants/Bario/rules.html b/variants/Bario/rules.html
index f5fd782..733246f 100644
--- a/variants/Bario/rules.html
+++ b/variants/Bario/rules.html
@@ -15,7 +15,11 @@
 </p>
 
 <a href="https://www.bario-chess-checkers-chessphotography-spaceart.de/">
-  Complete rules description.
+  Author's website.
+</a>
+
+<a href="/variants/Bario/complete_rules.html">
+  Full rules description.
 </a>
 
 <p class="author">Panos Louridas (1985).</p>