Improve Spartan, Avalam + Emergo pieces
authorBenjamin Auder <benjamin.auder@somewhere>
Wed, 10 Feb 2021 13:43:57 +0000 (14:43 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Wed, 10 Feb 2021 13:43:57 +0000 (14:43 +0100)
client/public/images/pieces/Avalam/generateSVG.py
client/public/images/pieces/Emergo/generateSVG_composite.py
client/public/images/pieces/Emergo/generateSVG_simple.py
client/public/images/pieces/Spartan/SOURCE [new file with mode: 0644]
client/public/images/pieces/Spartan/bc.svg [changed from symlink to file mode: 0644]
client/public/images/pieces/Spartan/bg.svg [changed from symlink to file mode: 0644]
client/public/images/pieces/Spartan/bl.svg [changed from symlink to file mode: 0644]
client/public/images/pieces/Spartan/bp.svg [new file with mode: 0644]
client/src/variants/Spartan.js
server/db/queryGameStat.sql

index 8d52678..746a2be 100755 (executable)
@@ -12,7 +12,7 @@ black = '<circle cx="115" cy="115" r="100" fill="crimson" stroke="darkslategray"
 white = '<circle cx="115" cy="115" r="100" fill="gold" stroke="darkslategray"/>'
 
 digits = [
-    # 1
+    # 1 (unused here)
     '<path d="M130,85 v60"',
     # 2
     '<path d="M100,85 h30 v30 h-30 v30 h30"',
@@ -34,7 +34,8 @@ for color in ["white", "black"]:
         f.write("\n")
         f.write(white if color == "white" else black)
         f.write("\n")
-        f.write(digits[number] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if color == "white" else 'stroke="yellow"') + '/>')
-        f.write("\n")
+        if number >= 1:
+            f.write(digits[number] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if color == "white" else 'stroke="yellow"') + '/>')
+            f.write("\n")
         f.write(final)
         f.close()
index 1e37f2b..85726d5 100755 (executable)
@@ -21,7 +21,7 @@ black_bottom = '<circle cx="115" cy="115" r="100" fill="black"/>'
 
 digits = {
     "top": [
-        # 1
+        # 1 (unused here)
         '<path d="M130,35 v60"',
         # 2
         '<path d="M100,35 h30 v30 h-30 v30 h30"',
@@ -47,7 +47,7 @@ digits = {
         '<path d="M90,35 v60 M100,35 h30 v30 h-30 v30 h30"'
     ],
     "bottom": [
-        # 1
+        # 1 (unused here)
         '<path d="M130,135 v60"',
         # 2
         '<path d="M100,135 h30 v30 h-30 v30 h30"',
@@ -88,9 +88,11 @@ for colorTop in ["white", "black"]:
             f.write("\n")
             f.write(white_top if colorTop == "white" else black_top)
             f.write("\n")
-            f.write(digits["top"][top] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if colorTop == "white" else 'stroke="orange"') + '/>')
-            f.write("\n")
-            f.write(digits["bottom"][bottom] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if colorTop == "black" else 'stroke="orange"') + '/>')
-            f.write("\n")
+            if top >= 1:
+                f.write(digits["top"][top] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if colorTop == "white" else 'stroke="orange"') + '/>')
+                f.write("\n")
+            if bottom >= 1:
+                f.write(digits["bottom"][bottom] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if colorTop == "black" else 'stroke="orange"') + '/>')
+                f.write("\n")
             f.write(final)
             f.close()
index fd397af..c8ef826 100755 (executable)
@@ -12,7 +12,7 @@ black = '<circle cx="115" cy="115" r="100" fill="black"/>'
 white = '<circle cx="115" cy="115" r="100" fill="whitesmoke" stroke="saddlebrown"/>'
 
 digits = [
-    # 1
+    # 1 (unused)
     '<path d="M130,85 v60"',
     # 2
     '<path d="M100,85 h30 v30 h-30 v30 h30"',
@@ -49,7 +49,8 @@ for color in ["white", "black"]:
         f.write("\n")
         f.write(white if color == "white" else black)
         f.write("\n")
-        f.write(digits[number] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if color == "white" else 'stroke="orange"') + '/>')
-        f.write("\n")
+        if number >= 1:
+            f.write(digits[number] + ' fill="none" stroke-width="5" ' + ('stroke="red"' if color == "white" else 'stroke="orange"') + '/>')
+            f.write("\n")
         f.write(final)
         f.close()
diff --git a/client/public/images/pieces/Spartan/SOURCE b/client/public/images/pieces/Spartan/SOURCE
new file mode 100644 (file)
index 0000000..c34f13e
--- /dev/null
@@ -0,0 +1,2 @@
+Hoplite pawn drawn from:
+https://fr.m.wikipedia.org/wiki/Fichier:OOjs_UI_icon_bell.svg
deleted file mode 120000 (symlink)
index f7661a294dc1102fc90782fd02f4312249a3a813..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-../br.svg
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..899f48099dbfddb3cafbd22c708d7c66c5e04f41
--- /dev/null
@@ -0,0 +1,88 @@
+<?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"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   height="100%"
+   width="100%"
+   version="1.1"
+   viewBox="0 0 2048 2048"
+   id="svg16"
+   sodipodi:docname="br.svg"
+   inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
+  <metadata
+     id="metadata22">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs20" />
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="960"
+     inkscape:window-height="1060"
+     id="namedview18"
+     showgrid="false"
+     inkscape:zoom="0.43115234"
+     inkscape:cx="1024"
+     inkscape:cy="1024"
+     inkscape:window-x="0"
+     inkscape:window-y="20"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg16" />
+  <path
+     style="color:#000000"
+     d="m 1161,1706 h 170 v 137 h 274 V 1468 L 1383,1297 V 819 L 1553,649 V 444 h 153 V 205 H 341 v 239 h 153 v 205 l 171,170 v 478 l -222,171 v 375 h 273 v -137 h 171 v 137 h 274 z M 564,460 V 358 h 920 v 102 z m 460,1092 H 512 v -46 l 73,-55 h 879 l 71,55 v 46 z m 0,-169 H 674 l 60,-47 v -57 h 580 v 57 l 60,47 z m 0,-546 H 734 v -46 l -60,-58 h 700 l -60,58 v 46 z m 0,-172 H 610 l -46,-43 v -58 h 920 v 58 l -46,43 z"
+     fill-rule="nonzero"
+     display="block"
+     fill="#000000"
+     id="path2" />
+  <g
+     fill-rule="nonzero"
+     fill="#ffffff"
+     id="g14"
+     transform="matrix(1,0,0,-1,0,2048)">
+    <path
+       style="color:#000000"
+       d="m 564,1588 v 102 h 920 v -102 z"
+       display="block"
+       id="path4" />
+    <path
+       style="color:#000000"
+       d="M 1024,496 H 512 v 46 l 73,55 h 879 l 71,-55 v -46 z"
+       display="block"
+       id="path6" />
+    <path
+       style="color:#000000"
+       d="M 1024,665 H 674 l 60,47 v 57 h 580 v -57 l 60,-47 z"
+       display="block"
+       id="path8" />
+    <path
+       style="color:#000000"
+       d="M 1024,1211 H 734 v 46 l -60,58 h 700 l -60,-58 v -46 z"
+       display="block"
+       id="path10" />
+    <path
+       style="color:#000000"
+       d="M 1024,1383 H 610 l -46,43 v 58 h 920 v -58 l -46,-43 z"
+       display="block"
+       id="path12" />
+  </g>
+</svg>
deleted file mode 120000 (symlink)
index a41e488c4e9346947583273256b19d58c774a6fb..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-../Schess/be.svg
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..ae6789d8f7c9941fb1c4c2cbff576342c51d4801
--- /dev/null
@@ -0,0 +1,14 @@
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="100%" width="100%" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 2048 2048">
+ <path style="color:black;" d="m1161 1706h170v137h274v-375l-222-171v-478l170-170v-205h153v-239h-1365v239h153v205l171 170v478l-222 171v375h273v-137h171v137h274v-137zm-597-1246v-102h920v102h-920zm460 1092h-512v-46l73-55h879l71 55v46h-511zm0-169h-350l60-47v-57h580v57l60 47h-350zm0-546h-290v-46l-60-58h700l-60 58v46h-290zm0-172h-414l-46-43v-58h920v58l-46 43h-414z" fill-rule="nonzero" transform="translate(0,2048) scale(1,-1)" display="block" fill="#000"/>
+ <g fill-rule="nonzero" fill="#fff">
+  <path style="color:black;" d="m564 1588v102h920v-102h-920z" display="block"/>
+  <path style="color:black;" d="m1024 496h-512v46l73 55h879l71-55v-46h-511z" display="block"/>
+  <path style="color:black;" d="m1024 665h-350l60 47v57h580v-57l60-47h-350z" display="block"/>
+  <path style="color:black;" d="m1024 1211h-290v46l-60 58h700l-60-58v-46h-290z" display="block"/>
+  <path style="color:black;" d="m1024 1383h-414l-46 43v58h920v-58l-46-43h-414z" display="block"/>
+ </g>
+ <g fill-rule="nonzero" fill="#f00">
+ <path style="color:black;" d="M740,800 l560,360 v40 L740,840 z" display="block"/>
+ <path style="color:black;" d="M1300,800 l-560,360 v40 L1300,840 z" display="block"/>
+  </g>
+</svg>
deleted file mode 120000 (symlink)
index dfaa068876ece96a5bb855d66ce2e311a7b03ebe..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-../bb.svg
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..17ba73f9782d5132e1deb1235bfb5f9947ec4b26
--- /dev/null
@@ -0,0 +1,88 @@
+<?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"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   height="100%"
+   width="100%"
+   version="1.1"
+   viewBox="0 0 2048 2048"
+   id="svg16"
+   sodipodi:docname="bb.svg"
+   inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
+  <metadata
+     id="metadata22">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs20" />
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="960"
+     inkscape:window-height="1060"
+     id="namedview18"
+     showgrid="false"
+     inkscape:zoom="0.43115234"
+     inkscape:cx="1024"
+     inkscape:cy="1024"
+     inkscape:window-x="0"
+     inkscape:window-y="20"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg16" />
+  <path
+     style="color:#000000"
+     d="m 1290,564.11538 -42,102 q -102,22 -224,22 -121,0 -222,-22 l -42,-101 q 124,31 264,31 138,0 266,-32 z m -84,206 -29,70 v 27 q -76,11 -153,11 -75,0 -152,-11 l -1,-27 -27,-70 q 85,15 180,15 96,0 182,-15 z m -35,-378 q -40,30 -80,95 h -32 q 0,-49 23,-95 z m -206,0 q 23,49 23,95 h -32 q -39,-64 -81,-95 z m 59,-18 q -14,-57 -34,-79 -20,-22 -53,-46 -36,-25 -85,-42 -49,-17 -109,-9 l -281,39 q -17,2 -30,0 -13,-2 -26,-2 -21,0 -53,-9 -32,-9 -51,-28 l -97,159 q 18,20 32,28 14,8 33,17 58,27 124,33 28,2 55,1 27,-1 56,2 54,-9 108,-16 54,-7 110,-16 60,0 81,12 11,6 35,22 24,16 48,47 -53,6 -108,20 -55,14 -97,31 l 104,258 q -78,45 -109,72 -31,27 -49,64 -26,46 -33,89.00002 -7,43 -7,77 1,60 28,132 27,72 104,130 63,48 123,99 60,51 119,119 -74,38 -74,121 0,56 39,96 39,40 97,40 56,0 96,-40 40,-40 40,-96 0,-82 -74,-121 58,-68 117,-119 59,-51 125,-99 75,-57 102,-129 27,-72 29,-133 0,-34 -7,-77 -7,-43.00002 -32,-89.00002 -20,-36 -50,-63 -30,-27 -108,-73 l 104,-258 q -44,-16 -99,-30 -55,-14 -106,-21 23,-31 47,-47 24,-16 36,-22 21,-12 81,-12 54,8 108,15 54,7 110,17 27,-3 54,-2 27,1 57,-1 64,-6 124,-33 18,-9 32,-17 14,-8 33,-28 l -98,-159 q -18,18 -50,27 -32,9 -53,10 -13,0 -26,2 -13,2 -31,0 l -280,-39 q -60,-9 -111,8 -51,17 -85,45 -33,27 -52,46 -19,19 -33,77 z m -37,744.00002 v -85 q 0,-37.00002 37,-37.00002 37,0 37,37.00002 v 86 h 90 q 35,0 35,36 0,36 -35,36 h -90 v 90 q 0,37 -37,37 -37,0 -37,-37 v -90 h -88 q -35,0 -35,-36 0,-36 35,-36 z"
+     fill-rule="nonzero"
+     display="block"
+     fill="#000000"
+     id="path2" />
+  <g
+     fill-rule="nonzero"
+     fill="#ffffff"
+     id="g14"
+     transform="matrix(1,0,0,-1,0,2030.1154)">
+    <path
+       style="color:#000000"
+       d="m 1290,1466 -42,-102 q -102,-22 -224,-22 -121,0 -222,22 l -42,101 q 124,-31 264,-31 138,0 266,32 z"
+       display="block"
+       id="path4" />
+    <path
+       style="color:#000000"
+       d="m 1206,1260 -29,-70 v -27 q -76,-11 -153,-11 -75,0 -152,11 l -1,27 -27,70 q 85,-15 180,-15 96,0 182,15 z"
+       display="block"
+       id="path6" />
+    <path
+       style="color:#000000"
+       d="m 1171,1638 q -40,-30 -80,-95 h -32 q 0,49 23,95 z"
+       display="block"
+       id="path8" />
+    <path
+       style="color:#000000"
+       d="m 965,1638 q 23,-49 23,-95 h -32 q -39,64 -81,95 z"
+       display="block"
+       id="path10" />
+    <path
+       style="color:#000000"
+       d="m 987,912 v 85 q 0,37 37,37 37,0 37,-37 v -86 h 90 q 35,0 35,-36 0,-36 -35,-36 h -90 v -90 q 0,-37 -37,-37 -37,0 -37,37 v 90 h -88 q -35,0 -35,36 0,36 35,36 z"
+       display="block"
+       id="path12" />
+  </g>
+</svg>
diff --git a/client/public/images/pieces/Spartan/bp.svg b/client/public/images/pieces/Spartan/bp.svg
new file mode 100644 (file)
index 0000000..30f3063
--- /dev/null
@@ -0,0 +1,68 @@
+<?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"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="20"
+   height="20"
+   viewBox="0 0 20 20"
+   version="1.1"
+   id="svg6"
+   sodipodi:docname="bp.svg"
+   inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
+  <metadata
+     id="metadata12">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs10" />
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="960"
+     inkscape:window-height="1060"
+     id="namedview8"
+     showgrid="false"
+     inkscape:zoom="31.218764"
+     inkscape:cx="10"
+     inkscape:cy="10"
+     inkscape:window-x="0"
+     inkscape:window-y="20"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg6"
+     inkscape:document-rotation="0" />
+  <title
+     id="title2">Hoplite</title>
+  <path
+     d="m 15.954393,8.9177205 a 5.38,5.38 0 0 0 -4.46,-4.85 c 0.06,-0.69 -0.01,-2.15 -1.5399992,-2.15 -1.53,0 -1.6,1.46 -1.54,2.15 a 5.38,5.38 0 0 0 -4.46,4.85 v 6.0000005 l -2,2 v 1 H 17.954393 v -1 l -2,-2 z"
+     id="path4" />
+  <text
+     x="7.837368"
+     y="13.043901"
+     fill="#808080"
+     style="font-size:7.98644px;font-family:'DejaVu Sans', 'Bitstream Vera Sans';stroke-width:0.532429"
+     xml:space="preserve"
+     id="text4"
+     transform="scale(0.95601811,1.0460053)"><tspan
+       x="7.837368"
+       y="13.043901"
+       id="tspan2"
+       style="stroke-width:0.532429">v</tspan></text>
+</svg>
index 3b4fc77..acab8ad 100644 (file)
@@ -12,8 +12,7 @@ export class SpartanRules extends ChessRules {
   }
 
   getPpath(b) {
-    if ([V.LIEUTENANT, V.GENERAL, V.CAPTAIN, V.WARLORD].includes(b[1]))
-      return "Spartan/" + b;
+    if (b[0] == 'b' && b[1] != 'k') return "Spartan/" + b;
     return b;
   }
 
index c172090..6b8d5a1 100644 (file)
@@ -1,4 +1,5 @@
 select name,total
 from GameStat g
   join variants v on g.vid = v.id
-where total > 0;
+where total > 0
+order by total desc;