Fix HiddenRules
authorBenjamin Auder <benjamin.auder@somewhere>
Mon, 24 Feb 2020 16:55:53 +0000 (17:55 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Mon, 24 Feb 2020 16:55:53 +0000 (17:55 +0100)
client/public/images/pieces/Hidden/Question_mark_alternate.svg [deleted file]
client/public/images/pieces/Hidden/bp.svg
client/public/images/pieces/Hidden/wp.svg
client/src/base_rules.js
client/src/variants/Hidden.js

diff --git a/client/public/images/pieces/Hidden/Question_mark_alternate.svg b/client/public/images/pieces/Hidden/Question_mark_alternate.svg
deleted file mode 100644 (file)
index f88ab1e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   version="1.0"
-   width="679.47827"
-   height="881.67249"
-   id="svg11382">
-  <defs
-     id="defs11384" />
-  <g
-     transform="translate(-48.907487,-55.625885)"
-     id="layer1">
-    <g
-       id="g11476">
-      <path
-         d="M 474.50888,718.22841 L 303.49547,718.22841 L 303.49547,695.92707 C 303.49523,657.97599 307.79899,627.16496 316.40677,603.49388 C 325.01405,579.82356 340.04029,558.20693 357.06001,538.64392 C 374.07915,519.08181 399.04735,512.31128 458.51794,463.01307 C 490.20889,437.19104 513.79924,385.86077 513.79969,364.34133 C 516.01201,307.41888 499.85986,284.99913 479.23682,264.37609 C 456.56327,244.69892 418.56655,234.30611 388.2379,234.30611 C 360.45869,234.3068 319.77055,242.39482 300.4713,259.67658 C 274.53313,276.95966 235.23383,333.38269 243.42443,390.22235 L 48.907487,391.92457 C 48.907487,234.71058 78.301186,193.22992 147.9116,128.89425 C 215.30899,74.517607 274.44288,55.625885 391.75917,55.625885 C 481.47708,55.625885 553.65645,73.428695 606.08469,109.03174 C 677.29183,157.15646 728.38574,220.21528 728.38574,339.14455 C 728.38505,383.46536 709.23321,429.93093 685.31314,467.47754 C 666.92367,498.38692 624.93803,533.9299 567.10077,571.89382 C 524.2647,597.66242 500.42881,625.01308 490.06113,643.98842 C 479.6925,662.96445 474.50842,687.71109 474.50888,718.22841 L 474.50888,718.22841 z "
-         style="font-size:1201.92492676px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
-         id="path11472" />
-      <path
-         d="M 482.38298 869.80902 A 94.042557 73.021278 0 1 1  294.29787,869.80902 A 94.042557 73.021278 0 1 1  482.38298 869.80902 z"
-         transform="translate(1.106383,-5.5319149)"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-         id="path11474" />
-    </g>
-  </g>
-</svg>
index ba3ff2e..0c88e12 100644 (file)
    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    version="1.0"
-   width="679.47827"
+   width="881.47827"
    height="881.67249"
    id="svg11382"
-   sodipodi:docname="wp.svg"
+   sodipodi:docname="bp.svg"
    inkscape:version="0.92.4 5da689c313, 2019-01-14">
   <metadata
      id="metadata10">
      guidetolerance="10"
      inkscape:pageopacity="0"
      inkscape:pageshadow="2"
-     inkscape:window-width="1920"
-     inkscape:window-height="1180"
+     inkscape:window-width="960"
+     inkscape:window-height="590"
      id="namedview8"
      showgrid="false"
      inkscape:zoom="0.26767309"
-     inkscape:cx="347.21094"
+     inkscape:cx="354.68274"
      inkscape:cy="440.83624"
-     inkscape:window-x="0"
+     inkscape:window-x="960"
      inkscape:window-y="20"
      inkscape:window-maximized="0"
      inkscape:current-layer="svg11382" />
   <defs
      id="defs11384" />
   <g
-     transform="translate(-48.907487,-55.625885)"
+     transform="matrix(0.81855973,0,0,0.81779972,116.87412,36.698975)"
      id="layer1">
     <g
        id="g11476">
       <path
-         d="M 474.50888,718.22841 L 303.49547,718.22841 L 303.49547,695.92707 C 303.49523,657.97599 307.79899,627.16496 316.40677,603.49388 C 325.01405,579.82356 340.04029,558.20693 357.06001,538.64392 C 374.07915,519.08181 399.04735,512.31128 458.51794,463.01307 C 490.20889,437.19104 513.79924,385.86077 513.79969,364.34133 C 516.01201,307.41888 499.85986,284.99913 479.23682,264.37609 C 456.56327,244.69892 418.56655,234.30611 388.2379,234.30611 C 360.45869,234.3068 319.77055,242.39482 300.4713,259.67658 C 274.53313,276.95966 235.23383,333.38269 243.42443,390.22235 L 48.907487,391.92457 C 48.907487,234.71058 78.301186,193.22992 147.9116,128.89425 C 215.30899,74.517607 274.44288,55.625885 391.75917,55.625885 C 481.47708,55.625885 553.65645,73.428695 606.08469,109.03174 C 677.29183,157.15646 728.38574,220.21528 728.38574,339.14455 C 728.38505,383.46536 709.23321,429.93093 685.31314,467.47754 C 666.92367,498.38692 624.93803,533.9299 567.10077,571.89382 C 524.2647,597.66242 500.42881,625.01308 490.06113,643.98842 C 479.6925,662.96445 474.50842,687.71109 474.50888,718.22841 L 474.50888,718.22841 z "
-         style="font-size:1201.92492676px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
-         id="path11472" />
+         d="M 474.50888,718.22841 H 303.49547 v -22.30134 c -2.4e-4,-37.95108 4.30352,-68.76211 12.9113,-92.43319 8.60728,-23.67032 23.63352,-45.28695 40.65324,-64.84996 17.01914,-19.56211 41.98734,-26.33264 101.45793,-75.63085 31.69095,-25.82203 55.2813,-77.1523 55.28175,-98.67174 2.21232,-56.92245 -13.93983,-79.3422 -34.56287,-99.96524 -22.67355,-19.67717 -60.67027,-30.06998 -90.99892,-30.06998 -27.77921,6.9e-4 -68.46735,8.08871 -87.7666,25.37047 -25.93817,17.28308 -65.23747,73.70611 -57.04687,130.54577 l -194.516943,1.70222 c 0,-157.21399 29.393699,-198.69465 99.004113,-263.03032 67.39739,-54.376643 126.53128,-73.268365 243.84757,-73.268365 89.71791,0 161.89728,17.80281 214.32552,53.405855 71.20714,48.12472 122.30105,111.18354 122.30105,230.11281 -6.9e-4,44.32081 -19.15253,90.78638 -43.0726,128.33299 -18.38947,30.90938 -60.37511,66.45236 -118.21237,104.41628 -42.83607,25.7686 -66.67196,53.11926 -77.03964,72.0946 -10.36863,18.97603 -15.55271,43.72267 -15.55225,74.23999 z"
+         style="font-style:normal;font-weight:normal;font-size:1201.92492676px;font-family:'Bitstream Vera Sans';text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         id="path11472"
+         inkscape:connector-curvature="0" />
       <path
-         d="M 482.38298 869.80902 A 94.042557 73.021278 0 1 1  294.29787,869.80902 A 94.042557 73.021278 0 1 1  482.38298 869.80902 z"
+         d="m 482.38298,869.80902 a 94.042557,73.021278 0 1 1 -188.08511,0 94.042557,73.021278 0 1 1 188.08511,0 z"
          transform="translate(1.106383,-5.5319149)"
          style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-         id="path11474" />
+         id="path11474"
+         inkscape:connector-curvature="0" />
     </g>
   </g>
 </svg>
index c7792aa..e501622 100644 (file)
    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    version="1.0"
-   width="679.47827"
+   width="881.47827"
    height="881.67249"
    id="svg11382"
-   sodipodi:docname="wwp.svg"
+   sodipodi:docname="wp.svg"
    inkscape:version="0.92.4 5da689c313, 2019-01-14">
   <metadata
      id="metadata10">
@@ -36,7 +36,7 @@
      guidetolerance="10"
      inkscape:pageopacity="0"
      inkscape:pageshadow="2"
-     inkscape:window-width="1920"
+     inkscape:window-width="960"
      inkscape:window-height="1180"
      id="namedview8"
      showgrid="false"
   <defs
      id="defs11384" />
   <g
-     transform="translate(-48.907487,-55.625885)"
+     transform="matrix(0.77457422,0,0,0.80508808,126.49714,48.613775)"
      id="layer1">
     <g
        id="g11476">
       <path
-         d="M 474.50888,718.22841 L 303.49547,718.22841 L 303.49547,695.92707 C 303.49523,657.97599 307.79899,627.16496 316.40677,603.49388 C 325.01405,579.82356 340.04029,558.20693 357.06001,538.64392 C 374.07915,519.08181 399.04735,512.31128 458.51794,463.01307 C 490.20889,437.19104 513.79924,385.86077 513.79969,364.34133 C 516.01201,307.41888 499.85986,284.99913 479.23682,264.37609 C 456.56327,244.69892 418.56655,234.30611 388.2379,234.30611 C 360.45869,234.3068 319.77055,242.39482 300.4713,259.67658 C 274.53313,276.95966 235.23383,333.38269 243.42443,390.22235 L 48.907487,391.92457 C 48.907487,234.71058 78.301186,193.22992 147.9116,128.89425 C 215.30899,74.517607 274.44288,55.625885 391.75917,55.625885 C 481.47708,55.625885 553.65645,73.428695 606.08469,109.03174 C 677.29183,157.15646 728.38574,220.21528 728.38574,339.14455 C 728.38505,383.46536 709.23321,429.93093 685.31314,467.47754 C 666.92367,498.38692 624.93803,533.9299 567.10077,571.89382 C 524.2647,597.66242 500.42881,625.01308 490.06113,643.98842 C 479.6925,662.96445 474.50842,687.71109 474.50888,718.22841 L 474.50888,718.22841 z "
-         style="font-size:1201.92492676px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
-         id="path11472" />
+         d="M 474.50888,718.22841 H 303.49547 v -22.30134 c -2.4e-4,-37.95108 4.30352,-68.76211 12.9113,-92.43319 8.60728,-23.67032 23.63352,-45.28695 40.65324,-64.84996 17.01914,-19.56211 41.98734,-26.33264 101.45793,-75.63085 31.69095,-25.82203 55.2813,-77.1523 55.28175,-98.67174 2.21232,-56.92245 -13.93983,-79.3422 -34.56287,-99.96524 -22.67355,-19.67717 -60.67027,-30.06998 -90.99892,-30.06998 -27.77921,6.9e-4 -68.46735,8.08871 -87.7666,25.37047 -25.93817,17.28308 -65.23747,73.70611 -57.04687,130.54577 l -194.516943,1.70222 c 0,-157.21399 29.393699,-198.69465 99.004113,-263.03032 67.39739,-54.376643 126.53128,-73.268365 243.84757,-73.268365 89.71791,0 161.89728,17.80281 214.32552,53.405855 71.20714,48.12472 122.30105,111.18354 122.30105,230.11281 -6.9e-4,44.32081 -19.15253,90.78638 -43.0726,128.33299 -18.38947,30.90938 -60.37511,66.45236 -118.21237,104.41628 -42.83607,25.7686 -66.67196,53.11926 -77.03964,72.0946 -10.36863,18.97603 -15.55271,43.72267 -15.55225,74.23999 z"
+         style="font-style:normal;font-weight:normal;font-size:1201.92492676px;font-family:'Bitstream Vera Sans';text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         id="path11472"
+         inkscape:connector-curvature="0" />
       <path
-         d="M 482.38298 869.80902 A 94.042557 73.021278 0 1 1  294.29787,869.80902 A 94.042557 73.021278 0 1 1  482.38298 869.80902 z"
+         d="m 482.38298,869.80902 a 94.042557,73.021278 0 1 1 -188.08511,0 94.042557,73.021278 0 1 1 188.08511,0 z"
          transform="translate(1.106383,-5.5319149)"
          style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
-         id="path11474" />
+         id="path11474"
+         inkscape:connector-curvature="0" />
     </g>
   </g>
   <path
-     style="fill:#e6e6e6;stroke-width:3.7359004"
-     d="m 257.60455,627.07088 c 0.13081,-77.44018 25.92758,-127.32449 87.73844,-169.66364 36.10448,-24.7308 69.51363,-51.56596 82.9554,-66.63206 4.58302,-5.13687 14.69139,-21.10784 22.46307,-35.49106 13.57063,-25.11543 14.12488,-27.55712 13.99245,-61.64235 -0.12067,-31.03639 -1.39133,-37.90025 -10.12433,-54.68556 -12.41589,-23.86391 -33.47102,-42.23034 -59.45872,-51.86591 -27.08357,-10.04189 -86.25805,-10.32199 -114.31527,-0.5411 -26.73994,9.32167 -56.16229,36.87598 -71.19845,66.67801 -12.64031,25.0534 -21.32123,61.95414 -17.44663,74.16193 2.2776,7.17608 0.0903,7.34753 -93.739582,7.34753 H 2.3993279 L 4.5888517,283.36804 C 6.9945044,226.9288 14.180975,193.63076 31.8012,157.28141 46.031888,127.92444 107.84181,64.930251 141.55337,45.4264 198.61102,12.415645 264.97592,-0.2328682 361.98916,3.4134533 476.57112,7.7201096 543.42976,33.528998 607.54842,98.204671 c 46.39163,46.794659 68.22289,103.293679 68.35689,176.906659 0.0803,44.05439 -6.37819,69.76065 -28.08594,111.79091 -23.51177,45.52307 -54.94907,76.31018 -129.2165,126.54395 -65.24529,44.1313 -88.21689,74.75462 -92.06838,122.7358 L 424.64188,659.76 H 341.0956 257.54933 Z"
+     style="fill:#e6e6e6;stroke-width:2.95018005"
+     d="m 363.91347,598.2448 c 0.10131,-62.34617 20.08282,-102.50743 67.95992,-136.59417 27.96561,-19.91048 53.84347,-41.51515 64.25513,-53.64468 3.54986,-4.13564 11.37956,-16.99367 17.3993,-28.57343 10.51148,-20.22014 10.94077,-22.18591 10.8382,-49.62752 -0.0935,-24.98703 -1.07769,-30.51305 -7.84206,-44.02669 -9.61702,-19.21256 -25.92579,-33.99915 -46.05518,-41.75664 -20.97824,-8.0846 -66.81326,-8.3101 -88.54565,-0.43562 -20.71207,7.50476 -43.50188,29.6884 -55.14851,53.68167 -9.79083,20.17019 -16.51485,49.87853 -13.51369,59.70688 1.76416,5.77738 0.0699,5.91541 -72.60828,5.91541 h -74.41458 l 1.69596,-41.35628 c 1.86335,-45.43855 7.4298,-72.24641 21.07797,-101.51084 11.02272,-23.63494 58.89909,-74.35081 85.01122,-90.05313 44.19538,-26.57657 95.59992,-36.759727 170.74388,-33.824116 88.75223,3.467222 140.5392,24.245656 190.20386,76.315276 35.93376,37.67382 52.84369,83.1605 52.94749,142.42544 0.062,35.46767 -4.94039,56.16346 -21.75465,90.00153 -18.21161,36.65008 -42.56214,61.43641 -100.08777,101.87902 -50.5373,35.52958 -68.33053,60.18406 -71.31379,98.81313 l -1.46597,18.98238 H 428.58348 363.8707 Z"
      id="path3734"
      inkscape:connector-curvature="0" />
   <path
-     style="fill:#999999;stroke-width:3.7359004"
-     d="m 306.00164,874.67946 c -20.46793,-6.59916 -45.68973,-27.37932 -52.14398,-42.96126 -6.73547,-16.26085 -3.07431,-44.87763 7.58628,-59.29685 13.86628,-18.75515 48.4476,-34.20744 76.55425,-34.20744 91.51118,0 128.89948,87.78629 54.60914,128.22016 -23.77959,12.94247 -61.03582,16.48949 -86.60569,8.24539 z"
+     style="fill:#999999;stroke-width:2.95018005"
+     d="m 401.40061,797.59151 c -15.85393,-5.3129 -35.3901,-22.04276 -40.38939,-34.58759 -5.21714,-13.09142 -2.38129,-36.13045 5.87613,-47.73919 10.74048,-15.09955 37.52627,-27.54001 59.29696,-27.54001 70.88218,0 99.8422,70.6757 42.29883,103.22853 -18.41907,10.41983 -47.27677,13.27548 -67.08253,6.63826 z"
      id="path3736"
      inkscape:connector-curvature="0" />
   <path
-     style="fill:#e6e6e6;stroke-width:3.7359004"
-     d="m 259.4734,621.46703 c 6.28129,-88.10442 21.9745,-113.88938 108.80992,-178.78152 55.66017,-41.59491 67.14414,-53.85442 86.0333,-91.84351 13.00568,-26.15646 13.31169,-27.76551 11.72229,-61.64236 -1.86444,-39.7398 -8.47288,-56.12889 -31.65175,-78.49729 -25.62469,-24.72873 -45.10255,-30.98099 -96.51597,-30.98099 -38.83136,0 -47.33058,1.14717 -63.51031,8.57223 -20.63074,9.46769 -46.44195,32.55392 -60.02226,53.6855 -12.01718,18.69928 -24.0355,55.68115 -24.0355,73.96023 v 15.06145 l -23.34938,0.3724 c -17.42475,0.27791 -20.97953,1.13647 -14.00962,3.38367 5.13686,1.65621 -25.96451,2.09575 -69.114159,0.97677 C 40.680312,334.61463 4.887522,333.30392 4.290428,332.82093 3.693334,332.33794 4.9572298,307.77436 7.0990857,278.23519 13.95262,183.71542 26.403798,154.76712 85.716239,95.454679 119.27418,61.896737 130.81407,52.933841 157.09072,40.018961 213.43774,12.324601 235.64753,8.3160163 334.13529,8.0646743 426.84247,7.8280835 451.53707,11.036886 501.37436,29.795589 565.77034,54.034165 629.35924,112.05034 653.663,168.73814 c 12.78989,29.83208 18.97602,63.64202 19.0192,103.94882 0.0512,47.62706 -4.31896,67.19256 -23.87214,106.88052 -20.71912,42.05458 -55.31064,78.01535 -118.70203,123.40071 -76.01239,54.42142 -104.27787,89.69019 -104.49418,130.3846 -0.0299,5.27763 -1.06473,13.37826 -2.30371,18.00144 -2.24949,8.39401 -2.36785,8.40577 -84.40972,8.40577 h -82.15707 z"
+     style="fill:#e6e6e6;stroke-width:2.95018005"
+     d="m 365.36101,593.7332 c 4.86533,-70.93182 17.02088,-91.69098 84.28138,-143.93486 43.11293,-33.48758 52.00811,-43.35756 66.63916,-73.94212 10.07388,-21.05826 10.3109,-22.35368 9.0798,-49.62753 -1.44415,-31.99404 -6.56288,-45.1887 -24.51663,-63.19724 -19.84822,-19.9088 -34.93528,-24.94241 -74.75879,-24.94241 -30.07777,0 -36.66104,0.92357 -49.19344,6.90139 -15.98005,7.62232 -35.97275,26.20878 -46.49171,43.22155 -9.30819,15.05457 -18.61728,44.82824 -18.61728,59.54451 v 12.12578 l -18.08582,0.29983 c -13.49676,0.22373 -16.25021,0.91495 -10.85148,2.72414 3.97887,1.3334 -20.11144,1.68727 -53.53405,0.78639 -33.4226,-0.90087 -61.14678,-1.95611 -61.60928,-2.34496 -0.46248,-0.38885 0.51649,-20.1647 2.17551,-43.94633 5.30858,-76.09674 14.95294,-99.40267 60.89481,-147.15441 25.99312,-27.0171 34.93164,-34.23302 55.28485,-44.63063 43.64495,-22.29641 60.84808,-25.52367 137.13416,-25.726024 71.80859,-0.190469 90.93639,2.392894 129.53907,17.495304 49.87946,19.51419 99.13379,66.22232 117.95886,111.86099 9.90671,24.01745 14.69833,51.23743 14.73178,83.68796 0.0397,38.34398 -3.34535,54.09592 -18.49074,86.04823 -16.0485,33.85764 -42.8422,62.80922 -91.94354,99.34844 -58.87725,43.81404 -80.77094,72.2085 -80.93849,104.97108 -0.0232,4.24896 -0.82471,10.77069 -1.7844,14.49276 -1.7424,6.75791 -1.83407,6.76738 -65.38159,6.76738 H 363.2464 Z"
      id="path3743"
      inkscape:connector-curvature="0" />
   <path
-     style="fill:#e6e6e6;stroke-width:3.7359004"
-     d="m 296.74909,867.65796 c -10.28868,-4.79119 -24.15821,-14.9202 -30.82118,-22.5089 -10.52965,-11.9926 -12.11448,-16.49295 -12.11448,-34.40061 0,-11.33164 2.49636,-25.43042 5.54748,-31.33063 17.25166,-33.36104 81.11165,-48.61019 124.82232,-29.80636 46.96314,20.203 59.64314,67.57433 26.86232,100.35515 -26.79593,26.79593 -77.79406,34.68967 -114.29646,17.69135 z"
+     style="fill:#e6e6e6;stroke-width:2.95018005"
+     d="m 394.23381,791.93859 c -7.96934,-3.85734 -18.71233,-12.01208 -23.87329,-18.12165 -8.15598,-9.6551 -9.38357,-13.27828 -9.38357,-27.69552 0,-9.12297 1.93363,-20.47373 4.29695,-25.22392 13.36268,-26.85857 62.82698,-39.13548 96.68415,-23.99674 36.37643,16.26519 46.19804,54.40328 20.80685,80.79473 -20.75542,21.57308 -60.25727,27.92824 -88.53109,14.2431 z"
      id="path3745"
      inkscape:connector-curvature="0" />
 </svg>
index a47b853..da9fab7 100644 (file)
@@ -1261,7 +1261,7 @@ export const ChessRules = class ChessRules {
   // TODO: un-ambiguous notation (switch on piece type, check directions...)
   getNotation(move) {
     if (move.appear.length == 2 && move.appear[0].p == V.KING)
-      //castle
+      // Castle
       return move.end.y < move.start.y ? "0-0-0" : "0-0";
 
     // Translate final square
index 99b4a7a..c8d98eb 100644 (file)
@@ -42,6 +42,13 @@ export const VariantRules = class HiddenRules extends ChessRules {
     };
   }
 
+  // Turn a hidden piece or revealed piece into revealed piece:
+  static Decode(p) {
+    if (Object.keys(V.HIDDEN_DECODE).includes(p))
+      return V.HIDDEN_DECODE[p];
+    return p;
+  }
+
   static get PIECES() {
     return ChessRules.PIECES.concat(Object.values(V.HIDDEN_CODE));
   }
@@ -93,6 +100,13 @@ export const VariantRules = class HiddenRules extends ChessRules {
   }
 
   getBasicMove([sx, sy], [ex, ey], tr) {
+    if (
+      tr &&
+      Object.keys(V.HIDDEN_DECODE).includes(this.board[sx][sy].charAt(1))
+    ) {
+      // The transformed piece is a priori hidden
+      tr.p = V.HIDDEN_CODE[tr.p];
+    }
     let mv = new Move({
       appear: [
         new PiPo({
@@ -123,9 +137,9 @@ export const VariantRules = class HiddenRules extends ChessRules {
         })
       );
       // Pieces are revealed when they capture
-      if (Object.keys(V.HIDDEN_DECODE).includes(mv.appear[0].p))
-        mv.appear[0].p = V.HIDDEN_DECODE[mv.appear[0].p];
+      mv.appear[0].p = V.Decode(mv.appear[0].p);
     }
+
     return mv;
   }
 
@@ -139,6 +153,10 @@ export const VariantRules = class HiddenRules extends ChessRules {
     );
   }
 
+  filterValid(moves) {
+    return moves;
+  }
+
   static GenRandInitFen() {
     let pieces = { w: new Array(8), b: new Array(8) };
     // Shuffle pieces + pawns on two first ranks
@@ -176,7 +194,7 @@ export const VariantRules = class HiddenRules extends ChessRules {
       const queenPos = positions[randIndex];
       positions.splice(randIndex, 1);
 
-      // Get random square for queen
+      // Get random square for king
       randIndex = randInt(9);
       const kingPos = positions[randIndex];
       positions.splice(randIndex, 1);
@@ -241,4 +259,33 @@ export const VariantRules = class HiddenRules extends ChessRules {
     const moves = this.getAllValidMoves();
     return moves[randInt(moves.length)];
   }
+
+  getNotation(move) {
+    // Translate final square
+    const finalSquare = V.CoordsToSquare(move.end);
+
+    const piece = this.getPiece(move.start.x, move.start.y);
+    if (piece == V.PAWN) {
+      // Pawn move
+      let notation = "";
+      if (move.vanish.length > move.appear.length) {
+        // Capture
+        const startColumn = V.CoordToColumn(move.start.y);
+        notation = startColumn + "x" + finalSquare;
+      }
+      else notation = finalSquare;
+      if (move.appear.length > 0 && !["p","s"].includes(move.appear[0].p)) {
+        // Promotion
+        const appearPiece = V.Decode(move.appear[0].p);
+        notation += "=" + appearPiece.toUpperCase();
+      }
+      return notation;
+    }
+    // Piece movement
+    return (
+      piece.toUpperCase() +
+      (move.vanish.length > move.appear.length ? "x" : "") +
+      finalSquare
+    );
+  }
 };