Prepare images for Knightmate variant. Fix lastMove.fen early assignment (when =...
authorBenjamin Auder <benjamin.auder@somewhere>
Sat, 29 Feb 2020 03:15:20 +0000 (04:15 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Sat, 29 Feb 2020 03:15:20 +0000 (04:15 +0100)
client/public/images/pieces/Knightmate/bc.svg [new file with mode: 0644]
client/public/images/pieces/Knightmate/bn.svg [new file with mode: 0644]
client/public/images/pieces/Knightmate/wc.svg [new file with mode: 0644]
client/public/images/pieces/Knightmate/wn.svg [new file with mode: 0644]
client/src/components/BaseGame.vue
client/src/translations/rules/Shatranj/en.pug
client/src/translations/rules/Shatranj/es.pug
client/src/translations/rules/Shatranj/fr.pug

diff --git a/client/public/images/pieces/Knightmate/bc.svg b/client/public/images/pieces/Knightmate/bc.svg
new file mode 100644 (file)
index 0000000..0995449
--- /dev/null
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="45"
+   height="45"
+   viewBox="0 0 11.90625 11.90625"
+   version="1.1"
+   id="svg4393"
+   sodipodi:docname="CommonerB_Transparent.svg"
+   inkscape:version="0.92.1 r15371">
+  <defs
+     id="defs4387" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="3"
+     inkscape:cx="30.240069"
+     inkscape:cy="21.353804"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     units="px"
+     inkscape:window-width="1600"
+     inkscape:window-height="837"
+     inkscape:window-x="-8"
+     inkscape:window-y="-8"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata4390">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-285.09373)">
+    <g
+       id="g4572"
+       transform="matrix(0.28921369,0,0,0.28921369,-0.54713251,283.72613)">
+      <circle
+         id="circle4537"
+         r="2.5"
+         cy="13.5"
+         cx="22.5"
+         style="fill:#000000;stroke:#000000;stroke-width:1.5;stroke-linejoin:round" />
+      <circle
+         id="circle4539"
+         r="1.5"
+         cy="13.5"
+         cx="22.5"
+         style="fill:none;stroke:#ffffff;stroke-width:1.5;stroke-linejoin:round" />
+      <g
+         id="g4543"
+         style="fill:#000000;stroke:#000000;stroke-width:1.5;stroke-linejoin:round">
+        <!-- test -->
+        <path
+           id="path4541"
+           d="m 11.5,37 c 5.5,3.5 15.5,3.5 21,0 v -7 c 0,0 9,-4.5 6,-11 -5.5,-7 -26.5,-7 -32,0 -3,6.5 5,10.5 5,10.5 z"
+           inkscape:connector-curvature="0" />
+      </g>
+      <g
+         id="g4553"
+         style="fill:none;stroke:#ffffff;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round">
+        <!-- test -->
+        <path
+           id="path4545"
+           d="m 32,29.5 c 0,0 8.5,-4 6,-9.65 C 32.65,13 12.35,13 7,19.85 c -2.5,5.65 4.85,9 4.85,9"
+           inkscape:connector-curvature="0" />
+        <!-- talp -->
+        <path
+           id="path4547"
+           d="M 11.5,30 C 17,27 27,27 32.5,30"
+           inkscape:connector-curvature="0" />
+        <path
+           id="path4549"
+           d="m 11.5,33.5 c 5.5,-3 15.5,-3 21,0"
+           inkscape:connector-curvature="0" />
+        <path
+           id="path4551"
+           d="M 11.5,37 C 17,34 27,34 32.5,37"
+           inkscape:connector-curvature="0" />
+      </g>
+    </g>
+  </g>
+</svg>
diff --git a/client/public/images/pieces/Knightmate/bn.svg b/client/public/images/pieces/Knightmate/bn.svg
new file mode 100644 (file)
index 0000000..ad8982a
--- /dev/null
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   version="1.1"
+   width="45"
+   height="45"
+   id="svg2">
+  <metadata
+     id="metadata26">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs24" />
+  <g
+     transform="matrix(0.91130361,0,0,0.79322383,2.588207,13.389015)"
+     style="opacity:1;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.76425695;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+     id="g4306">
+    <path
+       d="m 22,10 c 10.5,1 16.5,8 16,29 l -23,0 c 0,-9 10,-6.5 8,-21"
+       style="fill:#000000;stroke:#000000;stroke-width:1.76425695"
+       id="path4308" />
+    <path
+       d="m 24,18 c 0.38,2.91 -5.55,7.37 -8,9 -3,2 -2.82,4.34 -5,4 -1.042,-0.94 1.41,-3.04 0,-3 -1,0 0.19,1.23 -1,2 -1,0 -4.003,1 -4,-4 0,-2 6,-12 6,-12 0,0 1.89,-1.9 2,-3.5 -0.73,-0.994 -0.5,-2 -0.5,-3 1,-1 3,2.5 3,2.5 l 2,0 c 0,0 0.78,-1.992 2.5,-3 1,0 1,3 1,3"
+       style="fill:#000000;stroke:#000000;stroke-width:1.76425695"
+       id="path4310" />
+    <path
+       d="m 9.5,25.5 a 0.5,0.5 0 1 1 -1,0 0.5,0.5 0 1 1 1,0 z"
+       style="fill:#ffffff;stroke:#ffffff;stroke-width:1.76425695"
+       id="path4312" />
+    <path
+       d="m 15,15.5 a 0.5,1.5 0 1 1 -1,0 0.5,1.5 0 1 1 1,0 z"
+       transform="matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)"
+       style="fill:#ffffff;stroke:#ffffff;stroke-width:1.76425695"
+       id="path4314" />
+    <path
+       d="M 24.55,10.4 24.1,11.85 24.6,12 c 3.15,1 5.65,2.49 7.9,6.75 2.25,4.26 3.25,10.31 2.75,20.25 l -0.05,0.5 2.25,0 L 37.5,39 C 38,28.94 36.62,22.15 34.25,17.66 31.88,13.17 28.46,11.02 25.06,10.5 l -0.51,-0.1 z"
+       style="fill:#ffffff;stroke:none"
+       id="path4316" />
+  </g>
+  <g
+     transform="translate(-60,1.0103499)"
+     id="g4453">
+    <g
+       id="g4445">
+      <path
+         id="path6570"
+         style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="m 82.499775,5.267496 0,-5.63" />
+      <path
+         id="path4410"
+         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="m 82.499775,18.637496 c 0,0 4.5,-7.5 3,-10.5 0,0 -1,-2.5 -3,-2.5 -2,0 -3,2.5 -3,2.5 -1.5,3 3,10.5 3,10.5" />
+      <path
+         id="path4412"
+         style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="m 92.499775,23.637496 c 0,0 9.000005,-4.5 6,-10.5 -4,-6.5 -13.5,-3.5 -16,4 l 0,3.5 0,-3.5 c -3.5,-7.5 -13,-10.5 -16,-4 -3,6 5,10 5,10 7.216512,-1.348919 14.289707,-1.694619 21,0.5 z" />
+      <path
+         id="path4414"
+         style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="m 79.999775,1.637496 5,0" />
+      <path
+         id="path4416"
+         style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="m 91.999775,23.137496 c 0,0 8.500005,-4 6.03,-9.65 -3.88,-5.85 -13.03,-1.85 -15.53,4.65 l 0.01,2.1 -0.01,-2.1 c -2.5,-6.5 -12.594,-10.5 -15.503,-4.65 -2.497,5.65 4.853,9 4.853,9" />
+      <path
+         id="path4418"
+         style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         d="m 71.9,23.237 c 5.5,-3 15.099775,-2.599504 20.599775,0.400496" />
+    </g>
+  </g>
+</svg>
diff --git a/client/public/images/pieces/Knightmate/wc.svg b/client/public/images/pieces/Knightmate/wc.svg
new file mode 100644 (file)
index 0000000..12f2b27
--- /dev/null
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="45"
+   height="45"
+   viewBox="0 0 11.90625 11.90625"
+   version="1.1"
+   id="svg4393"
+   inkscape:version="0.92.1 r15371"
+   sodipodi:docname="Commoner_Transparent.svg">
+  <defs
+     id="defs4387" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1"
+     inkscape:cx="5.1998528"
+     inkscape:cy="24.301903"
+     inkscape:document-units="mm"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     units="px"
+     inkscape:window-width="1600"
+     inkscape:window-height="837"
+     inkscape:window-x="-8"
+     inkscape:window-y="-8"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata4390">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-285.09373)">
+    <g
+       id="g4499"
+       transform="matrix(0.28598519,0,0,0.28598519,-0.47456997,283.80785)">
+      <g
+         id="g4399"
+         style="fill:#ffffff;stroke:#000000;stroke-width:1.5;stroke-linejoin:round">
+        <!-- bojt -->
+        <circle
+           id="circle4395"
+           r="2.5"
+           cy="13.5"
+           cx="22.5" />
+        <!-- test -->
+        <path
+           id="path4397"
+           d="m 11.5,37 c 5.5,3.5 15.5,3.5 21,0 v -7 c 0,0 9,-4.5 6,-11 -5.5,-7 -26.5,-7 -32,0 -3,6.5 5,10.5 5,10.5 z"
+           inkscape:connector-curvature="0" />
+      </g>
+      <g
+         id="g4407"
+         style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:round">
+        <!-- talp -->
+        <path
+           id="path4401"
+           d="M 11.5,30 C 17,27 27,27 32.5,30"
+           inkscape:connector-curvature="0" />
+        <path
+           id="path4403"
+           d="m 11.5,33.5 c 5.5,-3 15.5,-3 21,0"
+           inkscape:connector-curvature="0" />
+        <path
+           id="path4405"
+           d="M 11.5,37 C 17,34 27,34 32.5,37"
+           inkscape:connector-curvature="0" />
+      </g>
+    </g>
+  </g>
+</svg>
diff --git a/client/public/images/pieces/Knightmate/wn.svg b/client/public/images/pieces/Knightmate/wn.svg
new file mode 100644 (file)
index 0000000..e6fd853
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   id="svg2"
+   height="45"
+   width="45"
+   version="1.1">
+  <metadata
+     id="metadata26">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs24" />
+  <g
+     transform="matrix(0.91610696,0,0,0.79823588,57.448885,13.316423)"
+     id="g4389">
+    <path
+       d="m -38,10 c 10.5,1 16.5,8 16,29 l -23,0 c 0,-9 10,-6.5 8,-21"
+       style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path4226" />
+    <path
+       d="m -36,18 c 0.38,2.91 -5.55,7.37 -8,9 -3,2 -2.82,4.34 -5,4 -1.042,-0.94 1.41,-3.04 0,-3 -1,0 0.19,1.23 -1,2 -1,0 -4.003,1 -4,-4 0,-2 6,-12 6,-12 0,0 1.89,-1.9 2,-3.5 -0.73,-0.994 -0.5,-2 -0.5,-3 1,-1 3,2.5 3,2.5 l 2,0 c 0,0 0.78,-1.992 2.5,-3 1,0 1,3 1,3"
+       style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path4228" />
+    <path
+       d="m -50.5,25.5 a 0.5,0.5 0 0 1 -1,0 0.5,0.5 0 1 1 1,0 z"
+       style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path4230" />
+    <path
+       d="m -45.067,15.75 a 0.499989,1.499967 30.000728 0 1 -0.866,-0.5 0.499989,1.499967 30.000728 0 1 0.866,0.5 z"
+       style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.49996698;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path4232" />
+  </g>
+  <g
+     transform="translate(-60,0)"
+     id="g4509">
+    <path
+       id="path8"
+       style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 82.5,6.33 0,-5.63" />
+    <path
+       id="path10"
+       style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 80,2.7 5,0" />
+    <path
+       id="path12"
+       style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 82.5,19.7 c 0,0 4.5,-7.5 3,-10.5 0,0 -1,-2.5 -3,-2.5 -2,0 -3,2.5 -3,2.5 -1.5,3 3,10.5 3,10.5" />
+    <path
+       id="path16"
+       style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 98.5,14.2 c -4,-6.5 -13.5,-3.5 -16,4 l 0,3.5 0,-3.5 c -3.5,-7.5 -13,-10.5 -16,-4 -3,6 5,10 5,10 5.5,-3 15.5,-3 21,0 0,0 9,-4 6,-10 z" />
+  </g>
+</svg>
index 5fbc257..100f7ef 100644 (file)
@@ -359,6 +359,9 @@ export default {
           new Audio("/sounds/move.mp3").play().catch(() => {});
         if (this.vr.turn != initurn) {
           // Turn has changed: move is complete
+          if (!smove.fen)
+            // NOTE: only FEN of last sub-move is required (thus setting it here)
+            smove.fen = this.vr.getFen();
           this.inMultimove = false;
           const score = this.vr.getCurrentScore();
           if (score != "*") {
@@ -405,7 +408,6 @@ export default {
       if (received && this.cursor < this.moves.length - 1)
         this.gotoEnd();
       playMove();
-      this.lastMove.fen = this.vr.getFen();
       this.emitFenIfAnalyze();
     },
     cancelCurrentMultimove: function() {
index 5f65c1a..ec346ef 100644 (file)
@@ -8,8 +8,8 @@ ul
   li There is no castling option.
   li Stalemate or bare king counts as a win, but two bare kings count as a draw.
 p.
-  Note: the general is still represented as a queen, because I didn't find an
-  appropriate image. Please tell me if you have one :)
+  Note: I didn't find nice images for general and elephants.
+  Please tell me if you have some :)
 
 p
   | I implemented a slightly different version of Shatranj
index d4c7116..a5a68d3 100644 (file)
@@ -10,8 +10,8 @@ ul
     El empate y un rey desnudo cuentan como una victoria,
     pero solo dos reyes es equivalente a tablas.
 p.
-  Nota: el general todavía está representado por una dama, porque
-  No encontré una imagen adecuada. Dime si tienes uno :)
+  Nota: no encontré imágenes bonitas para el general y los elefantes.
+  Dime si tienes algo :)
 
 p
   | Implementé una versión ligeramente diferente de Shatranj como
index b0a1bdb..3029c3b 100644 (file)
@@ -10,8 +10,8 @@ ul
     Le pat ainsi qu'un roi nu compte comme une victoire,
     mais deux rois seuls équivaut à un match nul.
 p.
-  Note : le général est encore représenté par une dame, parce que
-  je n'ai pas trouvé d'image appropriée. Dites-moi si vous en avez une :)
+  Note : je n'ai pas trouvé de jolies images pour le général et les éléphants.
+  Dites-moi si vous en avez :)
 
 p
   | J'ai implémenté une version légèrement différente du Shatranj telle que