Chakart almost ready...
authorBenjamin Auder <benjamin.auder@somewhere>
Sat, 18 Jun 2022 12:28:15 +0000 (14:28 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Sat, 18 Jun 2022 12:28:15 +0000 (14:28 +0200)
base_rules.js
pieces/chakart_banana.svg [new file with mode: 0644]
pieces/chakart_bomb.svg [new file with mode: 0644]
pieces/chakart_egg.svg [new file with mode: 0644]
pieces/chakart_mushroom.svg [new file with mode: 0644]
pieces/empty.svg [new file with mode: 0644]
variants/Chakart/class.js
variants/Chakart/style.css

index 864bb33..080b02a 100644 (file)
@@ -87,6 +87,10 @@ export default class ChessRules {
       (!!this.options["recycle"] && !this.options["teleport"])
     );
   }
+  // Some variants do not store reserve state (Align4, Chakart...)
+  get hasReserveFen() {
+    return this.hasReserve;
+  }
 
   get noAnimate() {
     return !!this.options["dark"];
@@ -282,7 +286,7 @@ export default class ChessRules {
       parts.push(`"flags":"${this.getFlagsFen()}"`);
     if (this.hasEnpassant)
       parts.push(`"enpassant":"${this.getEnpassantFen()}"`);
-    if (this.hasReserve)
+    if (this.hasReserveFen)
       parts.push(`"reserve":"${this.getReserveFen()}"`);
     if (this.options["crazyhouse"])
       parts.push(`"ispawn":"${this.getIspawnFen()}"`);
@@ -663,24 +667,17 @@ export default class ChessRules {
       this.re_drawReserve(['w', 'b'], r);
   }
 
-  // NOTE: assume !!this.reserve
+  // NOTE: assume this.reserve != null
   re_drawReserve(colors, r) {
     if (this.r_pieces) {
       // Remove (old) reserve pieces
       for (let c of colors) {
-        if (!this.reserve[c])
-          continue;
-        Object.keys(this.reserve[c]).forEach(p => {
-          if (this.r_pieces[c][p]) {
-            this.r_pieces[c][p].remove();
-            delete this.r_pieces[c][p];
-            const numId = this.getReserveNumId(c, p);
-            document.getElementById(numId).remove();
-          }
+        Object.keys(this.r_pieces[c]).forEach(p => {
+          this.r_pieces[c][p].remove();
+          delete this.r_pieces[c][p];
+          const numId = this.getReserveNumId(c, p);
+          document.getElementById(numId).remove();
         });
-        let reservesDiv = document.getElementById("reserves_" + c);
-        if (reservesDiv)
-          reservesDiv.remove();
       }
     }
     else
@@ -689,6 +686,9 @@ export default class ChessRules {
     if (!r)
       r = container.querySelector(".chessboard").getBoundingClientRect();
     for (let c of colors) {
+      let reservesDiv = document.getElementById("reserves_" + c);
+      if (reservesDiv)
+        reservesDiv.remove();
       if (!this.reserve[c])
         continue;
       const nbR = this.getNbReservePieces(c);
@@ -1050,7 +1050,7 @@ export default class ChessRules {
       return "white";
     if (c == 'b')
       return "black";
-    return ""; //unidentified color
+    return "other-color"; //unidentified color
   }
 
   // Assume square i,j isn't empty
diff --git a/pieces/chakart_banana.svg b/pieces/chakart_banana.svg
new file mode 100644 (file)
index 0000000..b0f1fc9
--- /dev/null
@@ -0,0 +1,147 @@
+<?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:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="svg1"
+   sodipodi:version="0.32"
+   inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
+   width="400.00000pt"
+   height="400.00000pt"
+   sodipodi:docname="aa.svg"
+   version="1.1">
+  <metadata
+     id="metadata20" />
+  <defs
+     id="defs3">
+    <linearGradient
+       id="linearGradient855">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0.0000000;"
+         offset="0.0000000"
+         id="stop856" />
+      <stop
+         style="stop-color:#5f0e00;stop-opacity:0.41666666;"
+         offset="1.0000000"
+         id="stop857" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient829">
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0.52499998;"
+         offset="0.0000000"
+         id="stop830" />
+      <stop
+         style="stop-color:#ffffff;stop-opacity:0.0000000;"
+         offset="1.0000000"
+         id="stop831" />
+    </linearGradient>
+    <radialGradient
+       xlink:href="#linearGradient829"
+       id="radialGradient832" />
+    <linearGradient
+       xlink:href="#linearGradient829"
+       id="linearGradient850"
+       x1="62.831094"
+       y1="339.76997"
+       x2="312.91139"
+       y2="191.31802"
+       gradientTransform="scale(1.5329819,0.65232341)"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       xlink:href="#linearGradient855"
+       id="linearGradient854"
+       x1="109.53184"
+       y1="332.16704"
+       x2="370.90093"
+       y2="332.16704"
+       gradientTransform="scale(1.2211061,0.81892967)"
+       gradientUnits="userSpaceOnUse" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1"
+     inkscape:cx="303.06094"
+     inkscape:cy="199.24188"
+     inkscape:window-width="960"
+     inkscape:window-height="1060"
+     showgrid="true"
+     inkscape:window-x="0"
+     inkscape:window-y="20"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg1" />
+  <g
+     id="g845"
+     transform="matrix(1.0251326,0,0,1.0341708,7.390093,17.812187)">
+    <path
+       style="fill:#ffe200;fill-rule:evenodd;stroke:#000000;stroke-width:10;stroke-linejoin:round;stroke-dasharray:none"
+       d="M 388.75,93.75 C 370,76.25 420,63.75 426.25,70 c 10,5 -8.75,8.75 -7.5,17.5 1.25,8.75 0,55 10,57.5 10,2.5 22.5,11.25 22.5,23.75 C 482.5,246.25 360,458.75 70,352.5 65,348.75 37.5,317.5 32.5,310 30,301.25 26.25,280 41.25,272.5 170,238.75 318.75,305 386.25,153.75 c 11.25,-26.25 2.5,-60 2.5,-60 z"
+       id="path847"
+       sodipodi:nodetypes="cccccccccc"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:url(#linearGradient850);fill-rule:evenodd;stroke-width:1.00000003pt"
+       d="m 43.75,290 2.5,-12.5 C 138.75,242.5 310,316.25 392.5,157.5 351.25,270 278.75,338.75 43.75,290 Z"
+       id="path849"
+       sodipodi:nodetypes="cccc"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:#442400;fill-rule:evenodd;stroke-width:1.00000003pt"
+       d="M 386.15267,89.13626 C 389.06731,71.53588 415.26511,71.062953 422.59733,70.191604 434.58256,71.75792 407.11069,91.63626 386.15267,89.13626 Z"
+       id="path851"
+       sodipodi:nodetypes="ccc"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:#442400;fill-rule:evenodd;stroke-width:1.00000003pt"
+       d="m 32.517518,305.14122 c -0.932686,-18.36985 -1.865381,-24.42824 8.743911,-30.48663 4.61679,6.92518 3.749991,28.36984 -8.743911,30.48663 z"
+       id="path852"
+       sodipodi:nodetypes="ccc"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:url(#linearGradient854);fill-opacity:0.75;fill-rule:evenodd;stroke-width:1.00000003pt"
+       d="M 133.75,366.25 C 352.5,421.25 426.74042,283.12802 440,250 c 22.5,-40 8.75,-85 8.75,-85 -1.25,135 -142.5,243.75 -315,201.25 z"
+       id="path853"
+       sodipodi:nodetypes="cccc"
+       inkscape:connector-curvature="0" />
+  </g>
+  <metadata
+     id="metadata22">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:title>Clipart by Nicu Buculei - pear</dc:title>
+        <dc:rights>
+          <cc:Agent>
+            <dc:title>Nicu Buculei</dc:title>
+          </cc:Agent>
+        </dc:rights>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <cc:license
+           rdf:resource="http://web.resource.org/cc/PublicDomain" />
+        <dc:format>image/svg+xml</dc:format>
+      </cc:Work>
+      <cc:License
+         rdf:about="http://web.resource.org/cc/PublicDomain">
+        <cc:permits
+           rdf:resource="http://web.resource.org/cc/Reproduction" />
+        <cc:permits
+           rdf:resource="http://web.resource.org/cc/Distribution" />
+        <cc:permits
+           rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+</svg>
diff --git a/pieces/chakart_bomb.svg b/pieces/chakart_bomb.svg
new file mode 100644 (file)
index 0000000..74a432e
--- /dev/null
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
+
+<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"
+   version="1.1"
+   x="0px"
+   y="0px"
+   viewBox="0 0 1000 1000"
+   enable-background="new 0 0 1000 1000"
+   xml:space="preserve"
+   id="svg10"
+   sodipodi:docname="aw.svg"
+   inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"><defs
+   id="defs14" /><sodipodi:namedview
+   pagecolor="#ffffff"
+   bordercolor="#666666"
+   borderopacity="1"
+   objecttolerance="10"
+   gridtolerance="10"
+   guidetolerance="10"
+   inkscape:pageopacity="0"
+   inkscape:pageshadow="2"
+   inkscape:window-width="1920"
+   inkscape:window-height="1060"
+   id="namedview12"
+   showgrid="false"
+   inkscape:zoom="0.236"
+   inkscape:cx="-254.23729"
+   inkscape:cy="500"
+   inkscape:window-x="0"
+   inkscape:window-y="20"
+   inkscape:window-maximized="0"
+   inkscape:current-layer="svg10" />
+<metadata
+   id="metadata2"> Svg Vector Icons : http://www.onlinewebfonts.com/icon <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>
+<g
+   id="g8"
+   transform="matrix(0.9,0,0,0.9,49.985,50.015)"><g
+     transform="matrix(1,0,0,-1,0,1920)"
+     id="g6"><path
+       d="m 349.2,950.7 c -30.7,0 -60.7,4.1 -90.1,12.3 -29.4,8.2 -56.5,19.5 -81.2,34.1 -24.8,14.6 -47.6,32.3 -68.4,53.1 -20.9,20.9 -38.6,43.7 -53.1,68.4 -14.6,24.8 -25.9,51.8 -34.1,81.2 -8.2,29.4 -12.3,59.5 -12.3,90.2 0,28.6 4.2,57.1 12.6,85.4 8.4,28.3 19.9,54.2 34.5,77.8 14.6,23.6 31.5,45.7 50.7,66.1 19.2,20.5 39.7,38.3 61.4,53.3 21.7,15.1 44,27.4 66.9,36.9 v 91.2 h 94.2 c 0,37.7 9.1,69.5 27.3,95.5 18.2,26 42.7,42.2 73.3,48.4 8.8,1.8 17.5,2.6 26,2.6 28.4,0 54.8,-8.7 79.3,-26.2 24.5,-17.5 43.3,-41.3 56.3,-71.4 13.3,-30.9 31.7,-49.6 55,-56.2 6.5,-1.8 13.6,-2.6 21.1,-2.6 15.3,0 32.3,3.8 50.9,11.3 l -65.2,19.2 98,29 -49,89.7 89.7,-49 29,98 28.6,-98 90.1,49 -49,-89.7 98,-29 -98,-28.6 49,-90.1 -90.1,49 -28.6,-98 -29,98 -89.7,-49 36.9,67.1 c -25.4,-11.3 -49.3,-17 -71.6,-17 -11.6,0 -22,1.3 -31.3,3.8 -35.2,10.1 -61.7,35.8 -79.5,77.3 -10.8,25.4 -25.4,44.4 -43.9,56.9 -18.5,12.6 -37.6,18.8 -57.5,18.8 -6.3,0 -12.2,-0.6 -17.7,-1.9 -9.5,-1.8 -18.2,-4.8 -25.8,-9.2 -7.7,-4.4 -15.1,-10.6 -22.2,-18.5 -7.2,-7.9 -12.8,-18.6 -16.8,-32 -4,-13.4 -6,-29.2 -6,-47.3 h 94.2 v -91.2 c 36.9,-11.6 69.9,-27.8 98.8,-48.8 28.9,-21 52.6,-45.4 71,-73.3 18.5,-27.9 32.5,-58.5 42,-91.8 9.5,-33.3 14.3,-68.5 14.3,-105.7 0,-30.7 -4.1,-60.7 -12.3,-90.1 -8.2,-29.4 -19.5,-56.5 -34.1,-81.2 -14.6,-24.8 -32.3,-47.6 -53.1,-68.4 -20.9,-20.9 -43.7,-38.6 -68.4,-53.1 -24.8,-14.6 -51.8,-25.9 -81.2,-34.1 -29.2,-8.1 -59.2,-12.2 -89.9,-12.2 z"
+       id="path4"
+       inkscape:connector-curvature="0" /></g></g>
+<path
+   style="fill:#483e37;fill-opacity:1;stroke-width:3.81355929"
+   d="M 289.55515,910.8568 C 204.13872,888.49569 132.74726,830.84844 93.628906,752.65003 54.974192,675.37851 51.151601,586.83975 83.170924,510.42255 110.89217,444.26314 176.7069,374.55038 242.76043,341.38101 l 20.02118,-10.05382 v -41.88491 -41.8849 h 43.32627 43.32627 l 2.02758,-22.36049 c 2.53828,-27.99263 13.0488,-52.11172 31.71057,-72.76807 23.06851,-25.53409 39.83988,-32.53552 77.91439,-32.52643 28.11708,0.007 35.12349,1.42686 52.8398,10.71017 27.25265,14.28035 50.387,38.83267 65.9435,69.98538 23.8381,47.73712 49.37843,63.20909 90.65746,54.91907 30.35666,-6.09649 31.40085,-10.14374 4.5601,-17.67487 -12.82759,-3.59924 -23.32289,-7.61614 -23.32289,-8.92646 0,-1.31031 17.16101,-7.33829 38.1356,-13.3955 20.97457,-6.0572 38.13559,-11.84002 38.13559,-12.8507 0,-1.01067 -8.69762,-17.92393 -19.32808,-37.58502 -10.63045,-19.66108 -18.5736,-35.74743 -17.65144,-35.74743 0.92216,0 17.4867,8.72209 36.81008,19.38242 19.32338,10.66033 35.66327,18.81182 36.31084,18.11441 0.64763,-0.69741 6.72392,-19.28708 13.50294,-41.31039 l 12.3255,-40.042368 11.58392,40.042368 c 6.37112,22.02331 12.05344,40.6478 12.62738,41.38776 0.57393,0.73995 17.45611,-7.52865 37.51593,-18.37469 20.05981,-10.84603 36.47242,-18.63269 36.47242,-17.30368 0,1.32901 -8.60373,18.01189 -19.11943,37.07306 -10.51567,19.06118 -18.66715,35.0375 -18.11441,35.50292 0.55277,0.46542 17.30799,5.54526 37.23384,11.28853 19.92584,5.74326 37.4294,11.53506 38.89682,12.87064 1.46738,1.33559 -14.83558,7.40789 -36.22882,13.49401 -21.39327,6.08611 -39.34907,11.40066 -39.90184,11.8101 -0.55273,0.40942 7.74034,16.59656 18.42907,35.9714 10.68871,19.37484 18.69719,35.96382 17.79658,36.86441 -0.90058,0.90058 -17.48956,-7.1079 -36.86438,-17.79661 -19.37487,-10.68872 -35.67685,-18.86343 -36.22665,-18.16602 -0.5498,0.6974 -5.858,18.89692 -11.79602,40.44338 -5.93802,21.54645 -11.91169,37.84941 -13.27477,36.2288 -1.36312,-1.6206 -7.30499,-19.67854 -13.20415,-40.12875 -5.89915,-20.45021 -11.12327,-37.18221 -11.60911,-37.18221 -0.48585,0 -16.43675,8.58051 -35.44647,19.06781 -19.00975,10.48728 -35.68107,19.06779 -37.04747,19.06779 -1.36635,0 3.82619,-11.28423 11.53903,-25.07607 7.71285,-13.79183 13.27652,-25.82287 12.36375,-26.73563 -0.91273,-0.91276 -8.86893,0.88405 -17.68042,3.99293 -41.98321,14.81253 -81.13126,9.59082 -109.38067,-14.58961 -8.97994,-7.68648 -22.35309,-26.21943 -32.31285,-44.78019 -26.04505,-48.5368 -49.48974,-67.50164 -88.05196,-71.22676 -46.8725,-4.52791 -81.70923,26.06124 -86.2102,75.69876 l -2.05218,22.63183 h 42.47881 42.47882 v 41.54361 41.54361 l 25.2106,10.0925 c 82.60166,33.0677 140.77422,98.66952 166.11777,187.33269 11.78294,41.2221 12.62204,128.0017 1.60195,165.67403 -17.66521,60.38877 -43.39826,102.32229 -89.27649,145.48122 -35.69171,33.57618 -84.10442,59.98698 -131.91216,71.96255 -40.83805,10.22972 -107.31816,10.08023 -147.08678,-0.33064 z"
+   id="path16"
+   inkscape:connector-curvature="0" /><path
+   style="fill:#800080;fill-opacity:1;stroke-width:4.237288"
+   d="m 339.43336,917.31585 c -1.1845,-1.91653 -8.15809,-3.0911 -15.49689,-2.61009 -7.33878,0.48098 -16.20342,-0.28445 -19.69918,-1.70093 -3.49576,-1.41648 -11.12288,-3.38619 -16.94915,-4.37708 -5.82628,-0.99089 -14.82905,-3.16432 -20.00616,-4.82978 -5.17711,-1.66551 -10.68427,-2.65716 -12.23812,-2.20373 -1.55385,0.45347 -3.99176,-0.86555 -5.41758,-2.93119 -1.42581,-2.06563 -13.07967,-9.11555 -25.89747,-15.66657 -12.81779,-6.55097 -26.64195,-14.85317 -30.72034,-18.44936 -4.07839,-3.59619 -7.41525,-5.03246 -7.41525,-3.19174 0,1.84076 -3.9232,-1.64072 -8.71823,-7.73661 -4.79503,-6.09589 -10.03867,-10.69568 -11.65255,-10.22174 -1.61386,0.4739 -8.98466,-5.28296 -16.37955,-12.79309 -7.39488,-7.51013 -12.51086,-13.65479 -11.36885,-13.65479 1.14201,0 -4.50353,-8.10381 -12.54565,-18.00847 -8.04211,-9.90466 -19.99003,-28.49576 -26.550928,-41.31356 -6.560897,-12.8178 -13.618959,-24.47165 -15.684582,-25.89746 -2.065623,-1.42585 -3.495088,-4.28602 -3.176589,-6.35593 0.3185,-2.06996 -0.633807,-7.57712 -2.116235,-12.23814 -1.482429,-4.66101 -3.385303,-13.03161 -4.228608,-18.60127 -0.843305,-5.5697 -2.796895,-13.19682 -4.341311,-16.94915 C 60.78461,658.03758 60.27664,586.3136 68.01657,562.71186 c 6.897063,-21.03156 16.843405,-57.45439 16.070275,-58.84829 -0.501795,-0.90469 1.0044,-2.82951 3.3471,-4.27738 2.342701,-1.44787 4.889034,-5.40016 5.658517,-8.78287 0.769487,-3.38271 4.669991,-9.85047 8.667788,-14.3728 3.9978,-4.52233 6.39223,-9.64063 5.32095,-11.37399 -1.07128,-1.73336 1.17435,-4.34965 4.99029,-5.81396 3.81594,-1.46432 5.99998,-3.60047 4.85344,-4.74702 -3.51257,-3.51256 51.0336,-59.74638 76.47001,-78.83598 13.18787,-9.89728 26.36142,-20.84672 29.27455,-24.3321 2.91314,-3.48537 5.29661,-4.97025 5.29661,-3.29971 0,3.99936 26.64297,-9.7152 30.65546,-15.78001 1.71219,-2.58796 3.14227,-22.34309 3.17796,-43.90029 l 0.0649,-39.19492 h 44.94487 c 39.1304,0 44.61409,-0.86197 42.38807,-6.66289 -1.40624,-3.66459 -0.66706,-10.19388 1.64261,-14.50953 2.30966,-4.31565 4.6863,-14.66099 5.28141,-22.98963 0.59511,-8.32865 2.28077,-15.14682 3.74592,-15.15149 1.46514,-0.005 5.00321,-5.65611 7.86238,-12.55876 6.85854,-16.55796 43.98492,-51.00905 54.97016,-51.00905 4.76086,0 8.65517,-1.43009 8.65403,-3.17797 -0.003,-4.77961 55.42915,-2.47016 69.32673,2.88834 22.59818,8.71315 49.17441,31.23495 64.90492,55.0031 8.61839,13.022 20.52237,31.09379 26.45335,40.15954 5.93093,9.06576 17.93406,21.21518 26.6736,26.99872 13.85754,9.1705 19.20165,10.23646 41.78042,8.33366 28.77568,-2.42504 39.16098,-8.2736 26.61458,-14.98822 -4.3286,-2.31659 -8.82356,-4.45387 -9.98882,-4.74951 -20.55957,-5.21618 -21.26017,-5.69693 -16.55834,-11.36229 2.64368,-3.18545 6.33741,-4.84569 8.2083,-3.68942 1.87089,1.15626 8.80526,-0.13505 15.40971,-2.86956 14.0597,-5.8213 16.49953,-6.56324 23.91012,-7.27097 3.05034,-0.29131 8.91165,-2.99065 13.02521,-5.99853 6.4289,-4.70093 6.74462,-7.08097 2.24835,-16.94916 -2.87691,-6.31415 -6.83148,-11.48028 -8.78792,-11.48028 -1.9564,0 -3.1717,-1.43008 -2.7006,-3.17796 0.47111,-1.74788 -3.32826,-11.17801 -8.44305,-20.95585 -5.63665,-10.77553 -7.643,-18.8017 -5.09381,-20.37719 2.31318,-1.42962 4.20576,-0.95995 4.20576,1.0437 0,3.27017 34.91988,22.34653 40.42721,22.08498 1.23661,-0.0587 5.29919,2.94407 9.028,6.67288 6.43081,6.43083 15.50289,3.35011 16.5778,-5.62954 0.19534,-1.63135 2.50373,-8.13651 5.12987,-14.45589 2.62615,-6.31938 5.60208,-15.85328 6.61322,-21.18644 3.38183,-17.83697 7.92204,-28.764449 11.95123,-28.764449 2.19623,0 2.91361,1.746771 1.59411,3.881712 -1.31945,2.134941 -0.18728,9.285367 2.51627,15.889827 2.70339,6.60447 5.59941,15.82168 6.43556,20.4827 0.83614,4.66102 2.76347,11.33474 4.28296,14.83051 3.22729,7.42479 4.35538,11.16262 5.0836,16.84427 0.54543,4.25538 21.57331,-1.90286 25.86716,-7.57546 2.21852,-2.93088 40.95056,-21.98068 44.69111,-21.98068 2.703,0 0.54991,10.05457 -2.72212,12.71187 -4.36047,3.54126 -22.46907,40.03281 -21.55284,43.4322 0.4711,1.74788 -0.73246,3.17797 -2.67454,3.17797 -5.94398,0 -3.91584,12.67579 2.11865,13.24152 7.4833,0.70157 9.94453,1.44258 23.49542,7.0739 6.31937,2.62614 15.85327,5.37481 21.18644,6.10817 5.33318,0.73335 12.40615,3.02918 15.71771,5.10184 4.78022,2.99186 3.907,4.627 -4.23728,7.93436 -5.64208,2.29124 -14.07191,4.85959 -18.73293,5.70744 -4.66101,0.84786 -11.33474,2.76593 -14.83051,4.26237 -3.49576,1.49645 -11.08843,3.50549 -16.87262,4.46455 -5.78416,0.95905 -11.20191,2.42897 -12.03941,3.26649 -2.42733,2.42732 3.56729,18.55549 9.0625,24.38207 8.47335,8.98434 24.24606,45.57593 19.64538,45.57593 -2.3822,0 -9.03114,-3.07947 -14.77542,-6.84326 -5.74428,-3.76379 -10.47335,-5.19388 -10.50903,-3.17797 -0.0339,2.01592 -1.46576,1.53797 -3.17796,-1.0621 -1.71221,-2.60007 -11.17606,-8.81503 -21.03085,-13.81102 l -17.91775,-9.08362 -2.46539,9.82295 c -1.35597,5.40263 -3.01059,12.57098 -3.67695,15.92967 -0.66631,3.35869 -3.42491,11.51036 -6.13021,18.11483 -2.70525,6.60446 -4.12072,13.29922 -3.14546,14.87724 0.97525,1.57801 -0.91788,6.54939 -4.20699,11.04751 -3.28907,4.49812 -5.98017,6.0313 -5.98017,3.40708 0,-2.62422 -2.19822,-10.13909 -4.88496,-16.6997 -2.68674,-6.56061 -5.58305,-15.74195 -6.43627,-20.40297 -0.85322,-4.66101 -3.53873,-14.5775 -5.96784,-22.03664 -4.05894,-12.46395 -5.25326,-13.18083 -14.75017,-8.85375 -5.68352,2.58958 -10.33365,6.42156 -10.33365,8.51553 0,2.09397 -1.90678,2.62876 -4.23728,1.18842 -2.33051,-1.44033 -4.23729,-0.59947 -4.23729,1.86858 0,2.46804 -1.43009,4.09532 -3.17797,3.61616 -1.74788,-0.47916 -9.28029,2.38101 -16.73873,6.35593 -17.07881,9.10205 -17.82932,9.04715 -17.05385,-1.24745 0.35127,-4.66101 2.4572,-8.47457 4.68017,-8.47457 2.22301,0 2.86139,-1.18039 1.41873,-2.62309 -1.44272,-1.44269 0.14618,-5.39245 3.53105,-8.77723 6.46263,-6.46262 8.41297,-18.34839 2.97619,-18.13732 -1.74788,0.0679 -16.1478,3.66499 -31.99979,7.99363 -25.63237,6.9993 -30.95745,7.22753 -48.12025,2.06229 -29.97276,-9.02049 -46.0978,-21.13061 -63.12776,-47.40978 -30.73661,-47.43023 -36.39928,-55.14293 -48.21622,-65.67187 -18.26335,-16.2727 -27.28356,-19.87326 -54.88041,-21.90638 -47.48977,-3.49867 -77.49573,24.17029 -83.78315,77.25772 l -2.62065,22.12728 h 42.9631 42.9631 v 41.95837 41.95837 l 12.71186,4.43138 c 6.99153,2.43726 12.74106,3.10048 12.77674,1.47383 0.0339,-1.62665 1.46576,-0.83021 3.17797,1.76986 3.97902,6.04236 39.13004,23.98398 39.13004,19.97257 0,-1.65804 2.79953,0.68668 6.22118,5.2105 3.42161,4.52382 6.28178,6.5838 6.35594,4.57773 0.0742,-2.00606 3.88487,0.85411 8.46834,6.35593 4.58348,5.50183 8.39704,8.55306 8.47458,6.7805 0.0775,-1.77255 9.19818,6.99795 20.26809,19.49 30.19009,34.06858 42.87263,49.41079 40.84513,49.41079 -3.17894,0 16.22716,35.87852 21.16475,39.13003 2.60008,1.7122 3.49728,3.14228 1.99377,3.17797 -1.50352,0.0356 1.11826,11.98226 5.82618,26.54794 4.70788,14.56567 8.28221,31.84516 7.94288,38.39885 -0.3394,6.55369 0.55839,13.8175 1.99488,16.14178 4.07224,6.58907 2.28517,75.49373 -2.56924,99.06106 -2.40017,11.65254 -4.83758,24.04661 -5.41644,27.54237 -0.5789,3.49577 -2.53996,8.73941 -4.35797,11.65255 -1.81796,2.91313 -1.76284,5.3258 0.12246,5.36148 1.88543,0.0339 0.94907,1.63733 -2.0808,3.55924 -3.02992,1.9219 -5.81916,7.613 -6.19835,12.64699 -0.37924,5.03394 -2.06195,9.15262 -3.73949,9.15262 -3.09288,0 -7.94932,11.8703 -7.52555,18.39437 0.12712,1.96008 -2.38272,5.77364 -5.57784,8.47457 -3.19517,2.70089 -14.2567,16.1539 -24.58123,29.8956 -31.34708,41.72207 -101.84119,91.4239 -145.05273,102.26932 -6.40299,1.60703 -12.63823,4.53415 -13.8561,6.50475 -1.21787,1.97055 -4.9221,2.54372 -8.23163,1.27372 -3.30952,-1.26995 -8.49096,-0.78025 -11.5143,1.08827 -3.02333,1.86851 -10.69864,2.85169 -17.05623,2.18483 -6.35759,-0.66687 -13.89339,0.23008 -16.74621,1.99322 -7.09047,4.38216 -46.12317,4.6397 -48.79169,0.32203 z"
+   id="path18"
+   inkscape:connector-curvature="0" /></svg>
\ No newline at end of file
diff --git a/pieces/chakart_egg.svg b/pieces/chakart_egg.svg
new file mode 100644 (file)
index 0000000..91e2b18
--- /dev/null
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+
+<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"
+   version="1.1"
+   id="Layer_1"
+   x="0px"
+   y="0px"
+   viewBox="0 0 512 512"
+   style="enable-background:new 0 0 512 512;"
+   xml:space="preserve"
+   sodipodi:docname="ae.svg"
+   inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"><metadata
+   id="metadata85"><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="defs83" /><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="namedview81"
+   showgrid="false"
+   inkscape:zoom="0.4609375"
+   inkscape:cx="260.33898"
+   inkscape:cy="256"
+   inkscape:window-x="0"
+   inkscape:window-y="20"
+   inkscape:window-maximized="0"
+   inkscape:current-layer="Layer_1" />
+<path
+   style="fill:#73d8d0;stroke-width:0.90124917"
+   d="m 448.75595,290.86006 c 0,6.07477 -0.228,11.99821 -0.6726,17.79255 C 439.93995,416.79044 357.05625,474.88 256,474.88 154.9561,474.88 72.06005,416.79044 63.91665,308.65261 c -0.4446,-5.79348 -0.6726,-11.71777 -0.6726,-17.79255 0,-13.89033 1.1647,-27.96363 3.38675,-42.01641 C 83.5655,141.96095 161.9101,37.12 256,37.12 c 94.10225,0 172.4345,104.84095 189.3692,211.7245 2.22205,14.05193 3.38675,28.12608 3.38675,42.01556 z"
+   id="path2"
+   inkscape:connector-curvature="0" />
+<path
+   style="fill:#69ccc2;stroke-width:0.90124917"
+   d="m 256,37.124275 c -72.20665,0 -130.73425,134.199085 -130.73425,253.740055 0,118.60133 57.61465,183.00335 129.0404,184.00883 C 148.63765,474.19258 63.24405,409.75721 63.24405,290.86433 63.24405,171.32336 149.55155,37.124275 256,37.124275 Z"
+   id="path4"
+   inkscape:connector-curvature="0" />
+<path
+   style="fill:#e8564f;stroke-width:0.90124917"
+   d="m 448.75595,290.86006 c 0,6.07477 -0.228,11.99821 -0.6726,17.79255 H 63.91665 c -0.4446,-5.79348 -0.6726,-11.71778 -0.6726,-17.79255 0,-13.89033 1.1647,-27.96363 3.38675,-42.01641 h 378.7384 c 2.22205,14.05278 3.38675,28.12693 3.38675,42.01641 z"
+   id="path6"
+   inkscape:connector-curvature="0" />
+<g
+   id="g12"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+       <path
+   style="fill:#fc675b"
+   d="m 225,322.841 -60.533,30.266 c -22.39,11.189 -48.737,-5.095 -48.737,-30.127 v -80.748 c 0,-25.032 26.347,-41.316 48.737,-30.127 L 225,242.371"
+   id="path8"
+   inkscape:connector-curvature="0" />
+       <path
+   style="fill:#fc675b"
+   d="m 287.012,322.854 60.533,30.254 c 22.39,11.189 48.737,-5.095 48.737,-30.127 v -80.748 c 0,-25.032 -26.347,-41.316 -48.737,-30.127 l -60.533,30.254"
+   id="path10"
+   inkscape:connector-curvature="0" />
+</g>
+<g
+   id="g22"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+       <polygon
+   style="fill:#e8564f"
+   points="299.192,279.103 290.184,282.777 286.428,259.769 296.136,260.387 362.035,263.084 "
+   id="polygon14" />
+       <polygon
+   style="fill:#e8564f"
+   points="295.885,307.373 286.113,308.711 289.58,284.568 298.58,288.601 351.198,302.698 "
+   id="polygon16" />
+       <polygon
+   style="fill:#e8564f"
+   points="215.87,260.387 225.578,259.769 221.822,282.777 212.814,279.103 149.972,263.084 "
+   id="polygon18" />
+       <polygon
+   style="fill:#e8564f"
+   points="213.426,288.601 222.426,284.568 225.893,308.711 216.121,307.373 160.809,302.698 "
+   id="polygon20" />
+</g>
+<path
+   style="fill:#fc675b;stroke-width:0.90124917"
+   d="m 296.0368,278.7524 c 0,28.05084 -17.91985,50.80411 -40.0311,50.80411 -1.8981,0 -3.7715,-0.17272 -5.6088,-0.49762 -19.45695,-3.45932 -34.4337,-24.66674 -34.4337,-50.30734 0,-25.65086 14.97675,-46.85913 34.44605,-50.30735 1.8259,-0.32404 3.6993,-0.49761 5.59645,-0.49761 22.11125,0.002 40.0311,22.74471 40.0311,50.80581 z"
+   id="path24"
+   inkscape:connector-curvature="0" />
+<path
+   style="fill:#e8564f;stroke-width:0.90124917"
+   d="m 260.807,329.05975 c -19.45695,-3.45933 -34.4337,-24.66675 -34.4337,-50.30735 0,-25.65085 14.97675,-46.85913 34.44605,-50.30734 0.12445,-0.0231 0.2508,-0.0376 0.3762,-0.0581 -1.69955,-0.27873 -3.4276,-0.43862 -5.187,-0.43862 -1.8981,0 -3.7715,0.17271 -5.59645,0.49761 -19.4693,3.44822 -34.44605,24.65649 -34.44605,50.30735 0,25.63974 14.97675,46.84801 34.4337,50.30734 1.8373,0.32405 3.71165,0.49761 5.6088,0.49761 1.7575,0 3.4846,-0.15903 5.18225,-0.43776 -0.1292,-0.0214 -0.2565,-0.0376 -0.3838,-0.0607 z"
+   id="path26"
+   inkscape:connector-curvature="0" />
+<g
+   id="g48"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+       <circle
+   style="fill:#69ccc2"
+   cx="304.25699"
+   cy="163.00101"
+   r="7.7969999"
+   id="circle28" />
+       <circle
+   style="fill:#69ccc2"
+   cx="223.142"
+   cy="97.044998"
+   r="7.7969999"
+   id="circle30" />
+       <circle
+   style="fill:#69ccc2"
+   cx="211.58701"
+   cy="197.57899"
+   r="7.7969999"
+   id="circle32" />
+       <circle
+   style="fill:#69ccc2"
+   cx="351.022"
+   cy="86.753998"
+   r="7.7969999"
+   id="circle34" />
+       <circle
+   style="fill:#69ccc2"
+   cx="423.552"
+   cy="214.153"
+   r="7.7969999"
+   id="circle36" />
+       <circle
+   style="fill:#69ccc2"
+   cx="380.745"
+   cy="378.216"
+   r="7.7969999"
+   id="circle38" />
+       <circle
+   style="fill:#69ccc2"
+   cx="248.465"
+   cy="447.422"
+   r="7.7969999"
+   id="circle40" />
+       <circle
+   style="fill:#69ccc2"
+   cx="294.43399"
+   cy="363.92999"
+   r="7.7969999"
+   id="circle42" />
+       <circle
+   style="fill:#69ccc2"
+   cx="164.189"
+   cy="395.17001"
+   r="7.7969999"
+   id="circle44" />
+       <circle
+   style="fill:#69ccc2"
+   cx="133.05099"
+   cy="184.291"
+   r="7.7969999"
+   id="circle46" />
+</g>
+<g
+   id="g50"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g52"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g54"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g56"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g58"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g60"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g62"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g64"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g66"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g68"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g70"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g72"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g74"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g76"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+<g
+   id="g78"
+   transform="matrix(0.95,0,0,0.855,12.8,37.12)">
+</g>
+</svg>
\ No newline at end of file
diff --git a/pieces/chakart_mushroom.svg b/pieces/chakart_mushroom.svg
new file mode 100644 (file)
index 0000000..977697b
--- /dev/null
@@ -0,0 +1,183 @@
+<?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"
+   id="svg2"
+   height="48"
+   width="48"
+   version="1.0"
+   sodipodi:docname="am.svg"
+   inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)">
+  <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="namedview27"
+     showgrid="false"
+     inkscape:zoom="4.9166667"
+     inkscape:cx="24.40678"
+     inkscape:cy="24"
+     inkscape:window-x="0"
+     inkscape:window-y="20"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg2" />
+  <metadata
+     id="metadata4687">
+    <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>Tango Style 'Shroom</dc:title>
+        <dc:creator>
+          <cc:Agent>
+            <dc:title>Andrew Higginson</dc:title>
+          </cc:Agent>
+        </dc:creator>
+        <cc:license
+           rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
+      </cc:Work>
+      <cc:License
+         rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Reproduction" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#Distribution" />
+        <cc:requires
+           rdf:resource="http://creativecommons.org/ns#Notice" />
+        <cc:requires
+           rdf:resource="http://creativecommons.org/ns#Attribution" />
+        <cc:permits
+           rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
+        <cc:requires
+           rdf:resource="http://creativecommons.org/ns#ShareAlike" />
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs4">
+    <radialGradient
+       id="radialGradient5305"
+       gradientUnits="userSpaceOnUse"
+       cy="537.53"
+       cx="436.73"
+       gradientTransform="matrix(1.2279e-7,0.17872,-0.99562,6.8401e-7,748.63,140.01)"
+       r="212.52">
+      <stop
+         id="stop3220"
+         offset="0" />
+      <stop
+         id="stop3222"
+         stop-opacity="0"
+         offset="1" />
+    </radialGradient>
+    <radialGradient
+       id="radialGradient5307"
+       gradientUnits="userSpaceOnUse"
+       cy="314.05"
+       cx="276.82"
+       gradientTransform="matrix(0,0.88122,-1.8234,0,707.91,-204.77)"
+       r="212.52">
+      <stop
+         id="stop3262"
+         stop-color="#ef2929"
+         offset="0" />
+      <stop
+         id="stop3264"
+         stop-color="#c00"
+         offset="1" />
+    </radialGradient>
+  </defs>
+  <g
+     id="g5288"
+     transform="matrix(0.101252,0,0,0.101252,2.3665409,4.1268864)">
+    <g
+       id="g5267"
+       transform="matrix(0.55612,0,0,1,94.333,0)">
+      <path
+         id="path3284"
+         d="m 357.31,339.46 c -25,-51.89 -32.62,-95.94 -21.66,-115.92 10.7,-19.5 63.76,5.48 83.51,-26.73 C 438.63,165.05 387.5,2.96 204.62,2 24.26,1.0651 -9.71,169.06 5.09,197.76 c 14.54,28.2 63.72,7.23 83.514,22.31 19.796,15.09 5.112,83.53 -15.336,123.81 -20.194,39.79 75.402,49.97 147.04,49.02 71.63,-0.94 161.27,-3.05 137,-53.44 z"
+         inkscape:connector-curvature="0"
+         style="fill:#eeeeec;fill-rule:evenodd;stroke:#2e3436;stroke-width:12;stroke-linejoin:round" />
+      <path
+         id="path5246"
+         d="m 319.09,237.98 c -84.55,7.9 -144.44,5.87 -209,3.62 1.05,29.48 -9.91,74.95 -25.309,107.68 -1.47,3.13 -1.388,4.57 -1.156,5.63 0.232,1.05 0.83,2.36 3.031,4.34 4.404,3.96 15.084,8.86 29.154,12.28 28.14,6.84 69.17,9.15 104.35,8.69 35.76,-0.47 75.76,-1.51 101.59,-7.84 12.92,-3.17 21.66,-7.95 24.72,-11.6 3.06,-3.65 4.13,-6 -0.59,-15.81 -0.04,-0.05 -0.07,-0.11 -0.1,-0.16 -18.97,-41.02 -27.27,-78.79 -26.69,-106.83 z"
+         inkscape:connector-curvature="0"
+         style="fill:none;stroke:#ffffff;stroke-width:12" />
+      <path
+         id="path2383"
+         d="m 357.31,285.91 c -25,-51.9 -32.62,-42.39 -21.66,-62.37 10.7,-19.5 63.76,5.48 83.51,-26.73 C 438.63,165.05 387.5,2.96 204.62,2 24.26,1.0651 -9.71,169.06 5.09,197.76 c 14.54,28.2 63.72,7.23 83.514,22.31 19.796,15.09 5.112,29.97 -15.336,70.26 -20.194,39.78 70.882,14.91 142.51,13.96 71.64,-0.94 165.8,32 141.53,-18.38 z"
+         style="opacity:0.55128;fill:url(#radialGradient5305);fill-rule:evenodd"
+         inkscape:connector-curvature="0" />
+    </g>
+    <g
+       id="g5274"
+       transform="matrix(0.88922,0,0,1,23.542,0)">
+      <path
+         id="path2387"
+         d="m 303.55,227.32 c 40.31,-4.83 95.86,1.7 115.61,-30.51 C 438.63,165.05 387.5,2.96 204.62,2 24.26,1.0651 -9.71,169.06 5.09,197.76 c 14.54,28.2 74.881,30.19 111.84,31.76 36.93,1.56 146.92,2.55 186.62,-2.2 z"
+         style="fill:url(#radialGradient5307);fill-rule:evenodd;stroke:#780000;stroke-width:12;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+      <path
+         id="path3272"
+         d="m 72.617,124.5 c -4.775,14.67 -15.876,24.22 -24.791,21.31 -8.915,-2.9 -12.265,-17.15 -7.481,-31.82 4.775,-14.676 15.876,-24.22 24.791,-21.316 8.915,2.904 12.265,17.156 7.481,31.826 z"
+         inkscape:connector-curvature="0"
+         style="fill:#ffffff" />
+      <path
+         id="path3274"
+         d="m 145.64,80.871 c -9.45,10.458 -24.26,12.688 -33.06,4.98 -8.81,-7.708 -8.28,-22.433 1.18,-32.884 9.46,-10.458 24.26,-12.689 33.07,-4.981 8.8,7.708 8.27,22.434 -1.19,32.885 z"
+         inkscape:connector-curvature="0"
+         style="fill:#ffffff" />
+      <path
+         id="path3276"
+         d="m 282.76,129.11 c 5.48,14.38 -4.82,28.27 -22.99,31.03 -18.17,2.75 -37.33,-6.68 -42.78,-21.06 -5.48,-14.38 4.82,-28.28 22.99,-31.03 18.17,-2.76 37.33,6.67 42.78,21.06 z"
+         inkscape:connector-curvature="0"
+         style="fill:#ffffff" />
+      <path
+         id="path3278"
+         d="m 306.81,38.724 c 11.21,8.819 10.94,17.049 -0.59,18.38 -11.54,1.332 -29.97,-4.741 -41.16,-13.561 -11.2,-8.818 -10.93,-17.048 0.6,-18.38 11.53,-1.331 29.96,4.742 41.15,13.561 z"
+         inkscape:connector-curvature="0"
+         style="fill:#ffffff" />
+      <path
+         id="path3280"
+         d="m 374.03,167.81 c -4.64,13.78 -16.08,17.37 -25.55,8.03 -9.46,-9.35 -13.36,-28.09 -8.71,-41.86 4.64,-13.78 16.08,-17.38 25.55,-8.03 9.46,9.34 13.37,28.09 8.71,41.86 z"
+         inkscape:connector-curvature="0"
+         style="fill:#ffffff" />
+      <path
+         id="path3282"
+         d="m 167.42,169.44 c 6.27,15.6 -0.53,33.33 -15.19,39.58 -14.65,6.25 -31.61,-1.33 -37.86,-16.94 -6.27,-15.6 0.53,-33.32 15.18,-39.58 14.66,-6.25 31.61,1.34 37.87,16.94 z"
+         inkscape:connector-curvature="0"
+         style="fill:#ffffff" />
+      <path
+         id="path3288"
+         d="m 213.4,73.159 c -1.54,6.54 -8.62,11.423 -15.82,10.905 -7.19,-0.518 -11.78,-6.241 -10.23,-12.78 1.54,-6.54 8.63,-11.423 15.82,-10.905 7.2,0.518 11.78,6.24 10.23,12.78 z"
+         inkscape:connector-curvature="0"
+         style="fill:#ffffff" />
+      <path
+         id="path3290"
+         d="m 331.07,87.891 c 0.86,6.293 -2.92,9.92 -8.44,8.099 -5.52,-1.82 -10.68,-8.398 -11.53,-14.689 -0.86,-6.293 2.92,-9.92 8.44,-8.099 5.51,1.82 10.68,8.398 11.53,14.689 z"
+         inkscape:connector-curvature="0"
+         style="fill:#ffffff" />
+      <path
+         id="path5251"
+         d="M 204.56,14.625 C 118.31,14.176 69.6,53.079 42.31,95.594 28.667,116.85 20.681,139.13 17.062,157.38 c -3.618,18.24 -1.247,33.62 -0.75,34.59 4.068,7.89 18.629,15.34 38.719,19.28 20.09,3.94 43.895,4.87 62.439,5.66 36.09,1.53 147.8,2.27 184.56,-2.13 21.51,-2.57 45.33,-2.14 65.28,-4.94 19.96,-2.79 34.18,-8.34 41.1,-19.62 1.07,-1.76 3.38,-16.13 -1.1,-34.06 C 402.84,138.22 393.24,116.34 377.66,95.406 346.49,53.533 292.28,15.082 204.56,14.625 Z"
+         inkscape:connector-curvature="0"
+         style="opacity:0.66239002;fill:none;stroke:#ffffff;stroke-width:12;stroke-linejoin:round" />
+    </g>
+  </g>
+</svg>
diff --git a/pieces/empty.svg b/pieces/empty.svg
new file mode 100644 (file)
index 0000000..08ec906
--- /dev/null
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>
\ No newline at end of file
index 768f50e..cee0242 100644 (file)
@@ -34,6 +34,12 @@ export default class ChakartRules extends ChessRules {
   get hasEnpassant() {
     return false;
   }
+  get hasReserve() {
+    return true;
+  }
+  get hasReserveFen() {
+    return false;
+  }
 
   static get IMMOBILIZE_CODE() {
     return {
@@ -75,14 +81,28 @@ export default class ChakartRules extends ChessRules {
     return 'm';
   }
 
+  static get EGG_SURPRISE() {
+    return [
+      "kingboo", "bowser", "daisy", "koopa",
+      "luigi", "waluigi", "toadette", "chomp"];
+  }
+
+  pieces(color, x, y) {
+    let specials = {
+      'i': {"class": "invisible"}, //queen
+      'e': {"class": "egg"},
+      'm': {"class": "mushroom"},
+      'd': {"class": "banana"},
+      'w': {"class": "bomb"}
+    };
+    return Object.assign(specials, super.pieces(color, x, y));
+  }
+
   genRandInitFen(seed) {
     const gr = new GiveawayRules(
       {mode: "suicide", options: {}, genFenOnly: true});
-    return (
-      gr.genRandInitFen(seed).slice(0, -17) +
-      // Add Peach + Mario flags + capture counts
-      '{"flags":"1111","ccount":"000000000000"}'
-    );
+    // Add Peach + mario flags
+    return gr.genRandInitFen(seed).slice(0, -17) + '{"flags":"1111"}';
   }
 
   fen2board(f) {
@@ -115,33 +135,17 @@ export default class ChakartRules extends ChessRules {
     this.powerFlags = flags;
   }
 
-  getFen() {
-    return super.getFen() + " " + this.getCapturedFen();
-  }
-
   getFlagsFen() {
     return ['w', 'b'].map(c => {
       return ['k', 'q'].map(p => this.powerFlags[c][p] ? "1" : "0").join("");
     }).join("");
   }
 
-  getCapturedFen() {
-    const res = ['w', 'b'].map(c => Object.values(this.captured[c]));
-    return res[0].concat(res[1]).join("");
-  }
-
   setOtherVariables(fenParsed) {
-    super.setOtherVariables(fenParsed);
-    // Initialize captured pieces' counts from FEN
-    const allCapts = fenParsed.ccount.split("").map(x => parseInt(x, 10));
-    const pieces = ['p', 'r', 'n', 'b', 'q', 'k'];
-    this.captured = {
-      w: ArrayFun.toObject(pieces, allCapts.slice(0, 6)),
-      b: ArrayFun.toObject(pieces, allCapts.slice(6, 12))
-    };
-    this.reserve = { w: {}, b: {} }; //to be replaced by this.captured
-    this.moveStack = [];
+    this.setFlags(fenParsed.flags);
+    this.reserve = {}; //to be filled later
     this.egg = null;
+    this.moveStack = [];
   }
 
   // For Toadette bonus
@@ -175,12 +179,11 @@ export default class ChakartRules extends ChessRules {
     return moves;
   }
 
-  // Moving something. Potential effects resolved after playing
   getPotentialMovesFrom([x, y]) {
     let moves = [];
     if (this.egg == "toadette")
-      return this.getDropMovesFrom([x, y]);
-    if (this.egg == "kingboo") {
+      moves = this.getDropMovesFrom([x, y]);
+    else if (this.egg == "kingboo") {
       const initPiece = this.getPiece(x, y);
       const color = this.getColor(x, y);
       const oppCol = C.GetOppCol(color);
@@ -216,27 +219,184 @@ export default class ChakartRules extends ChessRules {
           }
         }
       }
-      return moves;
     }
-    // Normal case (including bonus daisy)
-    switch (this.getPiece(x, y)) {
-      case 'p':
-        moves = this.getPawnMovesFrom([x, y]); //apply promotions
+    else {
+      // Normal case (including bonus daisy)
+      const piece = this.getPiece(x, y);
+      switch (piece) {
+        case 'p':
+          moves = this.getPawnMovesFrom([x, y]); //apply promotions
+          break;
+        case 'q':
+          moves = this.getQueenMovesFrom([x, y]);
+          break;
+        case 'k':
+          moves = this.getKingMovesFrom([x, y]);
+          break;
+        case 'n':
+          moves = this.getKnightMovesFrom([x, y]);
+          break;
+        case 'b':
+        case 'r':
+          // explicitely listing types to avoid moving immobilized piece
+          moves = this.getRookOrBishopMovesFrom([x, y], piece);
+          break;
+      }
+    }
+    // Set potential random effects, so that play() is deterministic
+    moves.forEach(m => {
+      switch (this.getPiece(m.end.x, m.end.y)) {
+        case V.EGG:
+          m.egg = Random.sample(V.EGG_SURPRISE);
+          m.next = this.getEggEffect(m);
+          break;
+        case V.BANANA:
+          m.next = this.getRandomSquare(
+            [m.end.x, m.end.y], [[1, 1], [1, -1], [-1, 1], [-1, -1]]);
+          break;
+        case V.BOMB:
+          m.next = this.getRandomSquare(
+            [m.end.x, m.end.y], [[1, 0], [-1, 0], [0, 1], [0, -1]]);
+          break;
+      }
+    });
+    return moves;
+  }
+
+  getEggEffect(move) {
+    const getRandomPiece = (c) => {
+      let bagOfPieces = [];
+      for (let i=0; i<this.size.x; i++) {
+        for (let j=0; j<this.size.y; j++) {
+          if (this.getColor(i, j) == c && this.getPiece(i, j) != 'k')
+            bagOfPieces.push([i, j]);
+        }
+      }
+      if (bagOfPieces.length >= 1)
+        return Random.sample(bagOfPieces);
+      return null;
+    };
+    const color = this.turn;
+    let em = null;
+    switch (move.egg) {
+      case "luigi":
+      case "waluigi":
+        // Change color of friendly or enemy piece, king excepted
+        const oldColor = (move.egg == "waluigi" ? color : C.GetOppCol(color));
+        const newColor = C.GetOppCol(oldColor);
+        const coords = getRandomPiece(oldColor);
+        if (coords) {
+          const piece = this.getPiece(coords[0], coords[1]);
+          em = new Move({
+            appear: [
+              new PiPo({x: coords[0], y: coords[1], c: newColor, p: piece})
+            ],
+            vanish: [
+              new PiPo({x: coords[0], y: coords[1], c: oldColor, p: piece})
+            ]
+          });
+        }
         break;
-      case 'q':
-        moves = this.getQueenMovesFrom([x, y]);
+      case "bowser":
+        em = new Move({
+          appear: [
+            new PiPo({
+              x: move.end.x,
+              y: move.end.y,
+              c: color,
+              p: V.IMMOBILIZED_CODE[move.appear[0].p]
+            })
+          ],
+          vanish: [
+            new PiPo({
+              x: move.end.x,
+              y: move.end.y,
+              c: color,
+              p: move.appear[0].p
+            })
+          ]
+        });
         break;
-      case 'k':
-        moves = this.getKingMovesFrom([x, y]);
+      case "koopa":
+        // Reverse move
+        em = new Move({
+          appear: [
+            new PiPo({
+              x: move.start.x, y: move.start.y, c: color, p: move.appear[0].p
+            })
+          ],
+          vanish: [
+            new PiPo({
+              x: move.end.x, y: move.end.y, c: color, p: move.appear[0].p
+            })
+          ]
+        });
         break;
-      case 'n':
-        moves = this.getKnightMovesFrom([x, y]);
+      case "chomp":
+        // Eat piece
+        em = new Move({
+          appear: [],
+          vanish: [
+            new PiPo({
+              x: move.end.x, y: move.end.y, c: color, p: move.appear[0].p
+            })
+          ],
+          end: {x: move.end.x, y: move.end.y}
+        });
         break;
-      case 'b':
-      case 'r':
-        // explicitely listing types to avoid moving immobilized piece
-        moves = super.getPotentialMovesFrom([x, y]);
     }
+    return em;
+  }
+
+  // Helper to set and apply banana/bomb effect
+  getRandomSquare([x, y], steps, freeSquare) {
+    let validSteps = steps.filter(s => this.onBoard(x + s[0], y + s[1]));
+    if (freeSquare) {
+      // Square to put banana/bomb cannot be occupied by a piece
+      validSteps = validSteps.filter(s => {
+        return ["", 'a'].includes(this.getColor(x + s[0], y + s[1]))
+      });
+    }
+    if (validSteps.length == 0)
+      return null;
+    const step = validSteps[Random.randInt(validSteps.length)];
+    return [x + step[0], y + step[1]];
+  }
+
+  getPotentialMovesOf(piece, [x, y]) {
+    const color = this.getColor(x, y);
+    const stepSpec = this.pieces(color, x, y)[piece];
+    let moves = [];
+    const findAddMoves = (type, stepArray) => {
+      for (let s of stepArray) {
+        outerLoop: for (let step of s.steps) {
+          let [i, j] = [x + step[0], y + step[1]];
+          let stepCounter = 1;
+          while (
+            this.onBoard(i, j) &&
+            (
+              this.board[i][j] == "" ||
+              [V.MUSHROOM, V.EGG].includes(this.getPiece(i, j))
+            )
+          ) {
+            if (type != "attack")
+              moves.push(this.getBasicMove([x, y], [i, j]));
+            if (s.range <= stepCounter++)
+              continue outerLoop;
+            [i, j] = [i + step[0], j + step[1]];
+          }
+          if (!this.onBoard(i, j))
+            continue;
+          const pieceIJ = this.getPiece(i, j);
+          if (type != "moveonly" && this.getColor(i, j) != color)
+            moves.push(this.getBasicMove([x, y], [i, j]));
+        }
+      }
+    };
+    const specialAttack = !!stepSpec.attack;
+    if (specialAttack)
+      findAddMoves("attack", stepSpec.attack);
+    findAddMoves(specialAttack ? "moveonly" : "all", stepSpec.moves);
     return moves;
   }
 
@@ -275,12 +435,57 @@ export default class ChakartRules extends ChessRules {
         moves.push(this.getBasicMove([x, y], [x + shiftX, y + shiftY]));
       }
     }
-    super.pawnPostProcess(moves, color, oppCol);
+    this.pawnPostProcess(moves, color, oppCol);
+    // Add mushroom on initial square
+    moves.forEach(m => {
+      m.appear.push(new PiPo({x: m.start.x, y: m.start.y, c: 'a', p: 'm'}));
+    });
     return moves;
   }
 
+  getRookOrBishopMovesFrom([x, y], type) {
+    // Add banana if possible, diagonaly
+    return this.getPotentialMovesOf(type, [x, y]).map(m => {
+      const bs =
+        this.getRandomSquare([m.end.x, m.end.y],
+          type == 'r'
+            ? [[1, 1], [1, -1], [-1, 1], [-1, -1]]
+            : [[1, 0], [-1, 0], [0, 1], [0, -1]],
+          "freeSquare");
+      if (bs) {
+        m.appear.push(
+          new PiPo({
+            x: bs[0],
+            y: bs[1],
+            c: 'a',
+            p: type == 'r' ? 'd' : 'w'
+          })
+        );
+        if (this.board[bs[0]][bs[1]] != "") {
+          m.vanish.push(
+            new PiPo({
+              x: bs[0],
+              y: bs[1],
+              c: this.getColor(bs[0], bs[1]),
+              p: this.getPiece(bs[0], bs[1])
+            })
+          );
+        }
+      }
+      return m;
+    });
+  }
+
+  getKnightMovesFrom([x, y]) {
+    // Add egg on initial square:
+    return this.getPotentialMovesOf('n', [x, y]).map(m => {
+      m.appear.push(new PiPo({p: "e", c: "a", x: x, y: y}));
+      return m;
+    });
+  }
+
   getQueenMovesFrom(sq) {
-    const normalMoves = super.getPotentialMovesOf('q', sq);
+    const normalMoves = this.getPotentialMovesOf('q', sq);
     // If flag allows it, add 'invisible movements'
     let invisibleMoves = [];
     if (this.powerFlags[this.turn]['q']) {
@@ -293,7 +498,7 @@ export default class ChakartRules extends ChessRules {
         ) {
           let im = JSON.parse(JSON.stringify(m));
           im.appear[0].p = V.INVISIBLE_QUEEN;
-          im.end.noHighlight = true;
+          im.noAnimate = true;
           invisibleMoves.push(im);
         }
       });
@@ -302,7 +507,7 @@ export default class ChakartRules extends ChessRules {
   }
 
   getKingMovesFrom([x, y]) {
-    let moves = super.getPotentialMovesOf('k', [x, y]);
+    let moves = this.getPotentialMovesOf('k', [x, y]);
     // If flag allows it, add 'remote shell captures'
     if (this.powerFlags[this.turn]['k']) {
       super.pieces()['k'].moves[0].steps.forEach(step => {
@@ -325,16 +530,16 @@ export default class ChakartRules extends ChessRules {
           const colIJ = this.getColor(i, j);
           if (colIJ != this.turn) {
             // May just destroy a bomb or banana:
-            moves.push(
-              new Move({
-                start: {x: x, y: y},
-                end: {x: i, y: j},
-                appear: [],
-                vanish: [
-                  new PiPo({x: i, y: j, c: colIJ, p: this.getPiece(i, j)})
-                ]
-              })
-            );
+            let shellCapture = new Move({
+              start: {x: x, y: y},
+              end: {x: i, y: j},
+              appear: [],
+              vanish: [
+                new PiPo({x: i, y: j, c: colIJ, p: this.getPiece(i, j)})
+              ]
+            });
+            shellCapture.shell = true; //easier play()
+            moves.push(shellCapture);
           }
         }
       });
@@ -342,107 +547,60 @@ export default class ChakartRules extends ChessRules {
     return moves;
   }
 
-  getKnightMovesFrom([x, y]) {
-    // Add egg on initial square:
-    return super.getPotentialMovesOf('n', [x, y]).map(m => {
-      m.appear.push(new PiPo({p: "e", c: "a", x: x, y: y}));
-      return m;
-    });
-  }
-
-/// if any of my pieces was immobilized, it's not anymore.
-  //if play set a piece immobilized, then mark it
   play(move) {
-    if (move.effect == "toadette") {
-      this.reserve = this.captured;
-      this.re_drawReserve([this.turn]);
-    }
-    else if (this.reserve) {
-      this.reserve = { w: {}, b: {} };
-      this.re_drawReserve([this.turn]);
-    }
+    this.egg = move.egg;
     const color = this.turn;
-    if (
-      move.vanish.length == 2 &&
-      move.vanish[1].c != 'a' &&
-      move.appear.length == 1 //avoid king Boo!
-    ) {
-      // Capture: update this.captured
-      let capturedPiece = move.vanish[1].p;
-      if (capturedPiece == V.INVISIBLE_QUEEN)
-        capturedPiece = V.QUEEN;
-      else if (Object.keys(V.IMMOBILIZE_DECODE).includes(capturedPiece))
-        capturedPiece = V.IMMOBILIZE_DECODE[capturedPiece];
-      this.captured[move.vanish[1].c][capturedPiece]++;
-    }
-    else if (move.vanish.length == 0) {
-      if (move.appear.length == 0 || move.appear[0].c == 'a')
-        return;
-      // A piece is back on board
-      this.captured[move.appear[0].c][move.appear[0].p]--;
+    if (move.egg == "toadette") {
+      this.reserve = { w: {}, b: {} };
+      // Randomly select a piece in pawnPromotions
+      this.reserve[color][Random.sample(this.pawnPromotions)] = 1;
+      this.re_drawReserve([color]);
     }
-    if (move.appear.length == 0) {
-      // Three cases: king "shell capture", Chomp or Koopa
-      if (this.getPiece(move.start.x, move.start.y) == V.KING)
-        // King remote capture:
-        this.powerFlags[color][V.KING] = false;
-      else if (move.end.effect == "chomp")
-        this.captured[color][move.vanish[0].p]++;
+    else if (Object.keys(this.reserve).length > 0) {
+      this.reserve = {};
+      this.re_drawReserve([color]);
     }
-    else if (move.appear[0].p == V.INVISIBLE_QUEEN)
-      this.powerFlags[move.appear[0].c][V.QUEEN] = false;
-    if (this.subTurn == 2) return;
-    if (
-      move.turn[1] == 1 &&
-      move.appear.length == 0 ||
-      !(Object.keys(V.IMMOBILIZE_DECODE).includes(move.appear[0].p))
-    ) {
-      // Look for an immobilized piece of my color: it can now move
-      for (let i=0; i<8; i++) {
-        for (let j=0; j<8; j++) {
-          if (this.board[i][j] != V.EMPTY) {
-            const piece = this.getPiece(i, j);
-            if (
-              this.getColor(i, j) == color &&
-              Object.keys(V.IMMOBILIZE_DECODE).includes(piece)
-            ) {
-              this.board[i][j] = color + V.IMMOBILIZE_DECODE[piece];
-              move.wasImmobilized = [i, j];
-            }
+    if (this.getPiece(move.end.x, move.end.y) == V.MUSHROOM)
+      move.next = this.getMushroomEffect(move);
+    if (move.shell)
+      this.powerFlags[color]['k'] = false;
+    else if (move.appear.length > 0 && move.appear[0].p == V.INVISIBLE_QUEEN)
+      this.powerFlags[move.appear[0].c]['q'] = false;
+    this.playOnBoard(move);
+    // Look for an immobilized piece of my color: it can now move
+    for (let i=0; i<8; i++) {
+      for (let j=0; j<8; j++) {
+        if ((i != move.end.x || j != move.end.y) && this.board[i][j] != "") {
+          const piece = this.getPiece(i, j);
+          if (
+            this.getColor(i, j) == color &&
+            Object.keys(V.IMMOBILIZE_DECODE).includes(piece)
+          ) {
+            this.board[i][j] = color + V.IMMOBILIZE_DECODE[piece];
           }
         }
       }
     }
     // Also make opponent invisible queen visible again, if any
-    const oppCol = V.GetOppCol(color);
+    const oppCol = C.GetOppCol(color);
     for (let i=0; i<8; i++) {
       for (let j=0; j<8; j++) {
         if (
-          this.board[i][j] != V.EMPTY &&
+          this.board[i][j] != "" &&
           this.getColor(i, j) == oppCol &&
           this.getPiece(i, j) == V.INVISIBLE_QUEEN
         ) {
           this.board[i][j] = oppCol + V.QUEEN;
-          move.wasInvisible = [i, j];
         }
       }
     }
-    this.playOnBoard(move);
-    if (["kingboo", "toadette", "daisy"].includes(move.effect)) {
-      this.effect = move.effect;
-      this.subTurn = 2;
-    }
-    else {
-      this.turn = C.GetOppCol(this.turn);
+    if (!move.next && !["daisy", "toadette", "kingboo"].includes(move.egg)) {
+      this.turn = oppCol;
       this.movesCount++;
-      this.subTurn = 1;
     }
-
-
     if (move.egg)
       this.displayBonus(move.egg);
-    else if (this.egg)
-      this.egg = null; //the egg is consumed
+    this.nextMove = move.next;
   }
 
   displayBonus(egg) {
@@ -453,84 +611,50 @@ export default class ChakartRules extends ChessRules {
     return moves;
   }
 
-  tryMoveFollowup(move, cb) {
-    // Warning: at this stage, the move is played
-    if (move.vanish.length == 2 && move.vanish[1].c == 'a') {
-      // effect, or bonus/malus
-      const endType = move.vanish[1].p;
-      switch (endType) {
-        case V.EGG:
-          this.applyRandomBonus(move, cb);
-          break;
-        case V.BANANA:
-        case V.BOMB: {
-          const dest =
-            this.getRandomSquare([m.end.x, m.end.y],
-              endType == V.BANANA
-                ? [[1, 1], [1, -1], [-1, 1], [-1, -1]]
-                : [[1, 0], [-1, 0], [0, 1], [0, -1]]);
-          cb(this.getBasicMove([move.end.x, move.end.y], dest));
-          break;
-        }
-        case V.MUSHROOM: {
-          let step = [move.end.x - move.start.x, move.end.y - move.start.y];
-          if ([0, 1].some(i => step[i] >= 2 && step[1-i] != 1)) {
-            // Slider, multi-squares: normalize step
-            for (let j of [0, 1])
-              step[j] = step[j] / Math.abs(step[j]) || 0;
-          }
-          const nextSquare = [move.end.x + step[0], move.end.y + step[1]];
-          if (this.onBoard(nextSquare[0], nextSquare[1])) {
-            if (
-              this.board[nextSquare[0]][nextSquare[1]] != "" &&
-              this.getColor(nextSquare[0], nextSquare[1]) != 'a'
-            ) {
-              // (try to) jump
-              const afterSquare =
-                [nextSquare[0] + step[0], nextSquare[1] + step[1]];
-              if (
-                this.onBoard(afterSquare[0], afterSquare[1]) &&
-                this.getColor(afterSquare[0], afterSquare[1]) != this.turn
-              ) {
-                cb(this.getBasicMove([move.end.x, move.end.y], afterSquare));
-              }
-            }
-            else if (!['b', 'r', 'q'].includes(move.vanish[0].p))
-              // Take another step forward if not slider move
-              cb(this.getBasicMove([move.end.x, move.end.y], nextSquare));
-          }
-          break;
-        }
-      }
+  getMushroomEffect(move) {
+    let step = [move.end.x - move.start.x, move.end.y - move.start.y];
+    if ([0, 1].some(i => step[i] >= 2 && step[1-i] != 1)) {
+      // Slider, multi-squares: normalize step
+      for (let j of [0, 1])
+        step[j] = step[j] / Math.abs(step[j]) || 0;
     }
+    const nextSquare = [move.end.x + step[0], move.end.y + step[1]];
+    const afterSquare =
+      [nextSquare[0] + step[0], nextSquare[1] + step[1]];
+    let nextMove = null;
+    if (
+      this.onBoard(nextSquare[0], nextSquare[1]) &&
+      this.board[nextSquare[0]][nextSquare[1]] == "" &&
+      ['k', 'p', 'n'].includes(move.vanish[0].p)
+    ) {
+      // Speed up non-sliders
+      nextMove = this.getBasicMove([move.end.x, move.end.y], nextSquare);
+    }
+    else if (
+      this.onBoard(afterSquare[0], afterSquare[1]) &&
+      this.board[nextSquare[0]][nextSquare[1]] != "" &&
+      this.getColor(nextSquare[0], nextSquare[1]) != 'a' &&
+      this.getColor(afterSquare[0], afterSquare[1]) != this.turn
+    ) {
+      nextMove = this.getBasicMove([move.end.x, move.end.y], afterSquare);
+    }
+    return nextMove;
   }
 
-  applyRandomBonus(move, cb) {
-    // TODO: determine bonus/malus, and then ...
-    // if toadette, daisy or kingboo : do not call cb
-    this.egg = "daisy"; //not calling cb in this case
-    this.displayBonus(this.egg);
-    move.egg = this.egg; //for play() by opponent
-  }
-
-  // Helper to apply banana/bomb effect
-  getRandomSquare([x, y], steps) {
-    const validSteps = steps.filter(s => this.onBoard(x + s[0], y + s[1]));
-    const step = validSteps[Random.randInt(validSteps.length)];
-    return [x + step[0], y + step[1]];
-  }
-
-  // Warning: if play() is called, then move.end changed.
   playPlusVisual(move, r) {
     this.moveStack.push(move);
     this.play(move);
     this.playVisual(move, r);
-    this.tryMoveFollowup(move, (nextMove) => {
-      if (nextMove)
-        this.playPlusVisual(nextMove, r);
-      else
-        this.afterPlay(this.moveStack);
-    });
+    if (this.nextMove)
+      this.playPlusVisual(this.nextMove, r);
+    else
+      this.afterPlay(this.moveStack);
   }
 
+  // TODO: set some special moves (effects) as noAnimate
+  // TODO: put bomb/banana only at final location of a move ? Seems more logical
+  // + fix bishop takes mushroom and jump
+  // Also improve showChoices for invisible queen + king shell
+  // + fix turn issues after multimove (like bishop put bomb)
+
 };
index 6cfd883..b60a821 100644 (file)
@@ -1,4 +1,31 @@
 @import url("/base_pieces.css");
 
-/* TODO: images des bananes/bombes/oeufs/champis + Chomp etc pour animations
- * Toadette/Waluigi/Luigi/King boo/Koopa/Daisy/Bowser avec petit texte */
+piece.egg {
+  background-image: url('/pieces/chakart_egg');
+}
+
+piece.mushroom {
+  background-image: url('/pieces/chakart_mushroom.svg');
+}
+
+piece.banana {
+  background-image: url('/pieces/chakart_banana.svg');
+}
+
+piece.bomb {
+  background-image: url('/pieces/chakart_bomb.svg');
+}
+
+piece.white.invisible {
+  background-image: url('/pieces/empty.svg');
+}
+piece.black.invisible {
+  background-image: url('/pieces/empty.svg');
+}
+
+piece.white.immobilized {
+  background-color: yellow;
+}
+piece.black.immobilized {
+  background-color: red;
+}