Draft Eightpieces rules. Fix display: PNG images + promotions on 2 lines
authorBenjamin Auder <benjamin.auder@somewhere>
Sat, 14 Mar 2020 23:05:22 +0000 (00:05 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Sat, 14 Mar 2020 23:05:22 +0000 (00:05 +0100)
59 files changed:
client/public/images/pieces/Eightpieces/SVG_TODO/bc.svg [moved from client/public/images/pieces/Eightpieces/bc.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/bd.svg [moved from client/public/images/pieces/Eightpieces/bd.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/be.svg [moved from client/public/images/pieces/Eightpieces/be.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/bf.svg [moved from client/public/images/pieces/Eightpieces/bf.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/bg.svg [moved from client/public/images/pieces/Eightpieces/bg.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/bh.svg [moved from client/public/images/pieces/Eightpieces/bh.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/bj.svg [moved from client/public/images/pieces/Eightpieces/bj.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/bm.svg [moved from client/public/images/pieces/Eightpieces/bm.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/bo.svg [moved from client/public/images/pieces/Eightpieces/bo.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/bs.svg [moved from client/public/images/pieces/Eightpieces/bs.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/wc.svg [moved from client/public/images/pieces/Eightpieces/wc.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/wd.svg [moved from client/public/images/pieces/Eightpieces/wd.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/we.svg [moved from client/public/images/pieces/Eightpieces/we.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/wf.svg [moved from client/public/images/pieces/Eightpieces/wf.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/wg.svg [moved from client/public/images/pieces/Eightpieces/wg.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/wh.svg [moved from client/public/images/pieces/Eightpieces/wh.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/wj.svg [moved from client/public/images/pieces/Eightpieces/wj.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/wm.svg [moved from client/public/images/pieces/Eightpieces/wm.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/wo.svg [moved from client/public/images/pieces/Eightpieces/wo.svg with 100% similarity]
client/public/images/pieces/Eightpieces/SVG_TODO/ws.svg [moved from client/public/images/pieces/Eightpieces/ws.svg with 100% similarity]
client/public/images/pieces/Eightpieces/tmp_png/bb.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bc.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bd.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/be.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bf.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bg.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bh.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bj.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bk.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bm.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bn.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bo.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bp.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bq.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/br.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/bs.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wb.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wc.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wd.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/we.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wf.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wg.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wh.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wj.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wk.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wm.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wn.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wo.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wp.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wq.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/wr.png [new file with mode: 0644]
client/public/images/pieces/Eightpieces/tmp_png/ws.png [new file with mode: 0644]
client/src/base_rules.js
client/src/components/Board.vue
client/src/translations/rules/Eightpieces/en.pug
client/src/translations/rules/Eightpieces/es.pug
client/src/translations/rules/Eightpieces/fr.pug
client/src/utils/printDiagram.js
client/src/variants/Eightpieces.js

diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bb.png b/client/public/images/pieces/Eightpieces/tmp_png/bb.png
new file mode 100644 (file)
index 0000000..77675f4
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 9c52566d58ad295865614ad8cef9d7d1ce653a06                 1929
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bc.png b/client/public/images/pieces/Eightpieces/tmp_png/bc.png
new file mode 100644 (file)
index 0000000..d097234
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 04326d5a5c48bd5cc09a0813fb4eaef356d65bec                58427
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bd.png b/client/public/images/pieces/Eightpieces/tmp_png/bd.png
new file mode 100644 (file)
index 0000000..ffd0f88
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat b6d42b75663feee7e82ecb25af460c2fb35856ac                86937
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/be.png b/client/public/images/pieces/Eightpieces/tmp_png/be.png
new file mode 100644 (file)
index 0000000..84d8dd4
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 6faf9fcf73eb1decace8e5b184584b7dee407474                61515
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bf.png b/client/public/images/pieces/Eightpieces/tmp_png/bf.png
new file mode 100644 (file)
index 0000000..f1dc5d7
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 5d1becd4ca9f78f23a31c9aff08445fa0049bfe9                83373
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bg.png b/client/public/images/pieces/Eightpieces/tmp_png/bg.png
new file mode 100644 (file)
index 0000000..d8f5fb5
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 9835efedfdf1ea4608f5a3e614805080a5626080                56194
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bh.png b/client/public/images/pieces/Eightpieces/tmp_png/bh.png
new file mode 100644 (file)
index 0000000..e5f3b25
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat efa009b523c9171675cdae9fd7efe5ab927474aa                76100
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bj.png b/client/public/images/pieces/Eightpieces/tmp_png/bj.png
new file mode 100644 (file)
index 0000000..5dad695
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 3c7dbfb71ec750c22838bd9dcbe5439911740e5e                68704
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bk.png b/client/public/images/pieces/Eightpieces/tmp_png/bk.png
new file mode 100644 (file)
index 0000000..25914fc
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat c2ef9bd3b4d64fa70e457dbca6c6c137ecaf9fa6                 3636
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bm.png b/client/public/images/pieces/Eightpieces/tmp_png/bm.png
new file mode 100644 (file)
index 0000000..7f7a226
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 133f69ee12f653f937c61df5b56622425748e5b1                59440
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bn.png b/client/public/images/pieces/Eightpieces/tmp_png/bn.png
new file mode 100644 (file)
index 0000000..d362738
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 0ffa52517f08bf09a72be978978168b57b8e88a6                 2412
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bo.png b/client/public/images/pieces/Eightpieces/tmp_png/bo.png
new file mode 100644 (file)
index 0000000..689f204
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 801ab41f8ec97c1df188d2a51dce3547d3e8e1d6                82812
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bp.png b/client/public/images/pieces/Eightpieces/tmp_png/bp.png
new file mode 100644 (file)
index 0000000..8040b8b
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat c05fd1d54fd9f810df6617d0c075f6cb4f444885                 1282
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bq.png b/client/public/images/pieces/Eightpieces/tmp_png/bq.png
new file mode 100644 (file)
index 0000000..3b6e8cc
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat dc2b64b09642ceacaa081f9d929cfc6cf2e08c5c                 3262
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/br.png b/client/public/images/pieces/Eightpieces/tmp_png/br.png
new file mode 100644 (file)
index 0000000..e60e838
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat a00737b9a9386590b0bff43defa54d2898f15842                 1126
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/bs.png b/client/public/images/pieces/Eightpieces/tmp_png/bs.png
new file mode 100644 (file)
index 0000000..d01f610
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 020e7011f8189468b877bf8a2eaa28e4d8d35fad                36927
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wb.png b/client/public/images/pieces/Eightpieces/tmp_png/wb.png
new file mode 100644 (file)
index 0000000..e1bfe00
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat c42d884d03ab602eaaed93f9122956f12f927b1f                 2727
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wc.png b/client/public/images/pieces/Eightpieces/tmp_png/wc.png
new file mode 100644 (file)
index 0000000..fa791a5
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 8fe31cc37dbcd20df8b0709bb5726ace486b0c52                63809
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wd.png b/client/public/images/pieces/Eightpieces/tmp_png/wd.png
new file mode 100644 (file)
index 0000000..5127860
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 35e1050c7d274c8ea0ee1344d0bbd2c30c460cd3                97525
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/we.png b/client/public/images/pieces/Eightpieces/tmp_png/we.png
new file mode 100644 (file)
index 0000000..18b5b13
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat c677edab8c0dde132cac60daacbab94da3f5fdc5                69790
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wf.png b/client/public/images/pieces/Eightpieces/tmp_png/wf.png
new file mode 100644 (file)
index 0000000..a129fb1
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 2d533c6fd5c39055daf54c0ab9c293854ed7cc09                89046
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wg.png b/client/public/images/pieces/Eightpieces/tmp_png/wg.png
new file mode 100644 (file)
index 0000000..f12c75e
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 93867ecc93215c19310e73107c3769d5a74a207a                81093
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wh.png b/client/public/images/pieces/Eightpieces/tmp_png/wh.png
new file mode 100644 (file)
index 0000000..d6f2634
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat ea2c640c7e457290a91aa47e0a95571e7cca5d20                98557
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wj.png b/client/public/images/pieces/Eightpieces/tmp_png/wj.png
new file mode 100644 (file)
index 0000000..b3ee05f
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 76c3a4bf8fc92ea846ee4cf1c10c1442a59641d9                73774
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wk.png b/client/public/images/pieces/Eightpieces/tmp_png/wk.png
new file mode 100644 (file)
index 0000000..38786f5
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat bc3cb320b359ac6bfaf255f42b53db5eeb5e5824                 3187
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wm.png b/client/public/images/pieces/Eightpieces/tmp_png/wm.png
new file mode 100644 (file)
index 0000000..0f7eea8
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 4cc90b50bdb09424a09fc09d184cebb240bbdcab                81539
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wn.png b/client/public/images/pieces/Eightpieces/tmp_png/wn.png
new file mode 100644 (file)
index 0000000..93eb68f
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 79b8998056839809721dd2b6553dea5234472d77                 2841
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wo.png b/client/public/images/pieces/Eightpieces/tmp_png/wo.png
new file mode 100644 (file)
index 0000000..b5fc561
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 434f5e0b47e01f9571f8629fadcb05348ae7b673               100569
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wp.png b/client/public/images/pieces/Eightpieces/tmp_png/wp.png
new file mode 100644 (file)
index 0000000..5c5b23b
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 538eede50c8d051294f736b27dd3ab1967f2eb76                 1904
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wq.png b/client/public/images/pieces/Eightpieces/tmp_png/wq.png
new file mode 100644 (file)
index 0000000..df71d17
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 5057d7628965459e86a1448549d7d69f89485399                 4333
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/wr.png b/client/public/images/pieces/Eightpieces/tmp_png/wr.png
new file mode 100644 (file)
index 0000000..0b1bd97
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 829a06618eaa0e3fe0780f75657534cc45167b76                 1321
diff --git a/client/public/images/pieces/Eightpieces/tmp_png/ws.png b/client/public/images/pieces/Eightpieces/tmp_png/ws.png
new file mode 100644 (file)
index 0000000..0524f50
--- /dev/null
@@ -0,0 +1 @@
+#$# git-fat 2ead14fd56360b53874674543b0c5732ad2e5c95               121829
index 326da6e..752d8ee 100644 (file)
@@ -73,6 +73,11 @@ export const ChessRules = class ChessRules {
     return V.CanFlip;
   }
 
+  static get IMAGE_EXTENSION() {
+    // All pieces should be in the SVG format
+    return ".svg";
+  }
+
   // Turn "wb" into "B" (for FEN)
   static board2fen(b) {
     return b[0] == "w" ? b[1].toUpperCase() : b[1];
index c2de176..447040f 100644 (file)
@@ -119,7 +119,7 @@ export default {
                         this.userColor,
                         this.score,
                         this.orientation) +
-                      ".svg"
+                      V.IMAGE_EXTENSION
                   }
                 })
               );
@@ -284,65 +284,76 @@ export default {
       // No choices to show at first drawing
       const squareWidth = boardElt.offsetWidth / sizeY;
       const offset = [boardElt.offsetTop, boardElt.offsetLeft];
-      // TODO: multi-rows if more than V.size.y pieces (as inEightpieces)
+      const maxNbeltsPerRow = Math.min(this.choices.length, sizeY);
+      let topOffset = offset[0] + (sizeY / 2) * squareWidth - squareWidth / 2;
+      let choicesHeight = squareWidth;
+      if (this.choices.length >= sizeY) {
+        // A second row is required (Eightpieces variant)
+        topOffset -= squareWidth / 2;
+        choicesHeight *= 2;
+      }
       const choices = h(
         "div",
         {
           attrs: { id: "choices" },
           class: { row: true },
           style: {
-            top: offset[0] + (sizeY / 2) * squareWidth - squareWidth / 2 + "px",
+            top: topOffset + "px",
             left:
               offset[1] +
-              (squareWidth * (sizeY - this.choices.length)) / 2 +
+              (squareWidth * Math.max(sizeY - this.choices.length, 0)) / 2 +
               "px",
-            width: this.choices.length * squareWidth + "px",
-            height: squareWidth + "px"
+            width: (maxNbeltsPerRow * squareWidth) + "px",
+            height: choicesHeight + "px"
           }
         },
-        this.choices.map(m => {
-          // A "choice" is a move
-          const applyMove = (e) => {
-            e.stopPropagation();
-            // Force a delay between move is shown and clicked
-            // (otherwise a "double-click" bug might occur)
-            if (Date.now() - this.clickTime < 200) return;
-            this.play(m);
-            this.choices = [];
-          };
-          const onClick =
-            this.mobileBrowser
-              ? { touchend: applyMove }
-              : { mouseup: applyMove };
-          return h(
-            "div",
-            {
-              class: {
-                board: true,
-                ["board" + sizeY]: true
-              },
-              style: {
-                width: 100 / this.choices.length + "%",
-                "padding-bottom": 100 / this.choices.length + "%"
-              }
-            },
-            [
-              h("img", {
-                attrs: {
-                  src:
-                    "/images/pieces/" +
-                    this.vr.getPPpath(
-                      m.appear[0].c + m.appear[0].p,
-                      // Extra arg useful for some variants:
-                      this.orientation) +
-                    ".svg"
+        [ h(
+          "div",
+          { },
+          this.choices.map(m => {
+            // A "choice" is a move
+            const applyMove = (e) => {
+              e.stopPropagation();
+              // Force a delay between move is shown and clicked
+              // (otherwise a "double-click" bug might occur)
+              if (Date.now() - this.clickTime < 200) return;
+              this.play(m);
+              this.choices = [];
+            };
+            const onClick =
+              this.mobileBrowser
+                ? { touchend: applyMove }
+                : { mouseup: applyMove };
+            return h(
+              "div",
+              {
+                class: {
+                  board: true,
+                  ["board" + sizeY]: true
                 },
-                class: { "choice-piece": true },
-                on: onClick
-              })
-            ]
-          );
-        })
+                style: {
+                  width: (100 / maxNbeltsPerRow) + "%",
+                  "padding-bottom": (100 / maxNbeltsPerRow) + "%"
+                }
+              },
+              [
+                h("img", {
+                  attrs: {
+                    src:
+                      "/images/pieces/" +
+                      this.vr.getPPpath(
+                        m.appear[0].c + m.appear[0].p,
+                        // Extra arg useful for some variants:
+                        this.orientation) +
+                      V.IMAGE_EXTENSION
+                  },
+                  class: { "choice-piece": true },
+                  on: onClick
+                })
+              ]
+            );
+          })
+        ) ]
       );
       elementArray.unshift(choices);
     }
index 3a33838..9a00364 100644 (file)
@@ -1,2 +1,42 @@
 p.boxed
-  | TODO
+  | Three new pieces appear. All pieces are unique.
+
+p.
+  There are only one rook, one bishop and one knight per side in this variant.
+  That explains the name. The king and queen are still there,
+  and the three remaining slots are taken by new pieces:
+
+ul
+  li.
+    The lancer 'L' is oriented and can only move in the direction it points,
+    by any number of squares as long as an enemy isn't met
+    (it can jump over friendly pieces). If an opponent' piece is found,
+    it can be captured. After moving you can reorient the lancer.
+  li.
+    The sentry 'S' moves like a bishop but doesn't capture directly.
+    It "pushes" enemy pieces instead, either on an empty square or on other
+    enemy pieces which are thus (self-)captured.
+  li.
+    The jailer 'J' moves like a rook but also doesn't capture.
+    It immobilizes enemy pieces which are vertically or horizontally adjacent.
+
+p.
+  On the following diagram the white sentry can push the black lancer to
+  capture the black pawn on b4. The lancer is then immobilized
+  by the white jailer at a4.
+
+figure.diagram-container
+  .diagram.diag12
+    | fen:7k/8/8/8/Jp3m2/8/3S4/K7:
+  .diagram.diag22
+    | fen:7k/8/8/8/Jm3S2/8/8/K7:
+  figcaption Left: before white move S"push"f4. Right: after this move.
+
+h3 Complete rules
+
+p
+  | The rules were invented by Jeff Kubach (2020), who described them much
+  | more precisely on the 
+  a(href="https://www.chessvariants.com/rules/8-piece-chess") chessvariants page
+  | . While the summary given above may suffice to start playing,
+  | you should read the complete rules to fully understand this variant.
index 3a33838..27bdf93 100644 (file)
@@ -1,2 +1,49 @@
 p.boxed
-  | TODO
+  | Aparecen tres nuevas piezas. Cada pieza es única.
+
+p.
+  Solo hay una torre, un alfil y un caballo por lado en esta variante.
+  Esto explica el nombre. El rey y la dama también están presentes.
+  Las tres ubicaciones restantes están ocupadas por nuevas piezas:
+
+ul
+  li.
+    La lanza 'L' está orientada y solo puede moverse en la dirección
+    como señala, tantas casillas como desee, siempre que lo haga
+    no encontrar pieza opuesta.
+    Si se encuentra dicha pieza, se puede capturar.
+    Después de mover puedes redirigir la lanza.
+  li.
+    La centinela 'S' (del término inglés "Sentry") se mueve como un alfil
+    pero no puede capturar directamente.
+    Por otro lado, puede "empujar" piezas opuestas sobre
+    una casilla vacía o en otra pieza enemiga, que luego termina
+    (auto-)capturado.
+  li.
+    El carcelero 'J' (del término inglés "Jailer") se mueve como una torre
+    pero tampoco captura. Inmoviliza cualquier pieza opuesta adyacente
+    vertical u horizontalmente.
+
+p.
+  En el siguiente diagrama, la centinela blanca puede empujar la lanza negra
+  para capturar el peón negro en b4. Entonces, la lanza es inmovilizada por el
+  carcelero blanco en a4.
+
+figure.diagram-container
+  .diagram.diag12
+    | fen:7k/8/8/8/Jp3m2/8/3S4/K7:
+  .diagram.diag22
+    | fen:7k/8/8/8/Jm3S2/8/8/K7:
+  figcaption.
+    Izquierda: antes del movimiento blanco S"empuja"f4.
+    Derecha: después de esta jugada.
+
+h3 Reglas completas
+
+p
+  | Las reglas fueron inventadas por Jeff Kubach (2020), quien las describió
+  | mucho más específicamente en la 
+  a(href="https://www.chessvariants.com/rules/8-piece-chess") página chessvariants
+  | . El resumen anterior puede ser suficiente para comenzar a jugar,
+  | pero deberías leer todas las reglas para entender completamente
+  | esta variante.
index 3a33838..f904b7d 100644 (file)
@@ -1,2 +1,46 @@
 p.boxed
-  | TODO
+  | Trois nouvelles pièces apparaissent. Chaque pièces est unique.
+
+p.
+  Il n'y a qu'une tour, un fou et un cavalier par camp dans cette variante.
+  Ceci explique le nom. Le roi et la dame sont également présents,
+  les trois emplacements restants étant pris par de nouvelles pièces :
+
+ul
+  li.
+    Le lancier 'L' est orienté et ne peut se déplacer que dans la direction
+    qu'il pointe, d'autant de cases qu'il le souhaite tant qu'il ne
+    rencontre pas de pièce adverse.
+    Si une telle pièce est trouvée, elle peut être capturée.
+    Après le déplacement vous pouvez réorienter le lancier.
+  li.
+    La sentinelle 'S' se déplace comme un fou mais ne peut pas capturer
+    directement. Elle peut en revanche "pousser" les pièces adverses sur
+    une case vide ou sur une autre pièce ennemie, qui se retrouve alors
+    (auto-)capturée.
+  li.
+    Le geôlier 'J' (du terme anglais "Jailer") se déplace comme une tour mais
+    ne capture pas non plus. Il immobilise toute pièce adverse adjacente
+    verticalement ou horizontalement.
+
+p.
+  Sur le diagramme suivant la sentinelle blanche peut pousser le lancier noir
+  pour capturer le pion noir en b4. Le lancier est alors immobilisé par le
+  geôlier blanc en a4.
+
+figure.diagram-container
+  .diagram.diag12
+    | fen:7k/8/8/8/Jp3m2/8/3S4/K7:
+  .diagram.diag22
+    | fen:7k/8/8/8/Jm3S2/8/8/K7:
+  figcaption Gauche : avant le coup blanc S"pousse"f4. Droite : après ce coup.
+
+h3 Règles complètes
+
+p
+  | Les règles ont été inventées par Jeff Kubach (2020), qui les a décrites
+  | beaucoup plus précisément sur la 
+  a(href="https://www.chessvariants.com/rules/8-piece-chess") page chessvariants
+  | . Le résumé donné ci-dessus peut suffire pour commencer à jouer,
+  | mais vous devriez lire l'intégralité des règles afin de bien comprendre
+  | cette variante.
index d4562bf..cc97939 100644 (file)
@@ -88,8 +88,8 @@ export function getDiagram(args) {
         boardDiv +=
           "<img " +
           "src='/images/pieces/" +
-          vr.getPpath(board[i][j]) +
-          ".svg' " +
+          vr.getPpath(board[i][j], null, null, orientation) +
+          V.IMAGE_EXTENSION + "' " +
           "class='piece'/>";
       }
       if (markArray.length > 0 && markArray[i][j])
index 46fe6b8..1b2e9a7 100644 (file)
@@ -13,6 +13,11 @@ export const VariantRules = class EightpiecesRules extends ChessRules {
     return "l";
   }
 
+  static get IMAGE_EXTENSION() {
+    // Temporarily, for the time SVG pieces are being designed:
+    return ".png";
+  }
+
   // Lancer directions *from white perspective*
   static get LANCER_DIRS() {
     return {
@@ -41,9 +46,9 @@ export const VariantRules = class EightpiecesRules extends ChessRules {
   }
 
   getPpath(b, color, score, orientation) {
-    if ([V.JAILER, V.SENTRY].includes(b[1])) return "Eightpieces/" + b;
+    if ([V.JAILER, V.SENTRY].includes(b[1])) return "Eightpieces/tmp_png/" + b;
     if (Object.keys(V.LANCER_DIRS).includes(b[1])) {
-      if (orientation == 'w') return "Eightpieces/" + b;
+      if (orientation == 'w') return "Eightpieces/tmp_png/" + b;
       // Find opposite direction for adequate display:
       let oppDir = '';
       switch (b[1]) {
@@ -72,9 +77,10 @@ export const VariantRules = class EightpiecesRules extends ChessRules {
           oppDir = 'f';
           break;
       }
-      return "Eightpieces/" + b[0] + oppDir;
+      return "Eightpieces/tmp_png/" + b[0] + oppDir;
     }
-    return b;
+    // TODO: after we have SVG pieces, remove the folder and next prefix:
+    return "Eightpieces/tmp_png/" + b;
   }
 
   getPPpath(b, orientation) {