From 65cf1690c6119c949e2ea8feba8835b6e90b79a2 Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Wed, 22 Jun 2022 11:53:09 +0200 Subject: [PATCH] Add Alice Chess, fix a few things in base_rules.js --- base_rules.js | 49 ++++-- pieces/Ambiguous/red_target.svg | 78 +++++++++ pieces/Ambiguous/target.svg | 191 ----------------------- pieces/Ambiguous/yellow_target.svg | 73 +++++++++ pieces/Benedict/CREDITS | 7 + pieces/Benedict/black_cleopatra.svg | 2 +- pieces/Benedict/black_cleopatra_TODO.svg | 1 + pieces/Benedict/white_cleopatra.svg | 2 +- pieces/Benedict/white_cleopatra_TODO.svg | 1 + {variants => pieces}/Chakart/CREDITS | 2 - variants.js | 2 +- variants/Alapo/class.js | 13 +- variants/Alapo/rules.html | 2 + variants/Alice/class.js | 126 +++++++++++++++ variants/Alice/rules.html | 7 + variants/Alice/style.css | 39 +++++ variants/Ambiguous/CREDITS | 3 - variants/Ambiguous/class.js | 12 +- variants/Ambiguous/style.css | 7 +- variants/Benedict/CREDITS | 4 - variants/Benedict/class.js | 18 +-- 21 files changed, 393 insertions(+), 246 deletions(-) create mode 100644 pieces/Ambiguous/red_target.svg delete mode 100644 pieces/Ambiguous/target.svg create mode 100644 pieces/Ambiguous/yellow_target.svg create mode 100644 pieces/Benedict/CREDITS mode change 100644 => 120000 pieces/Benedict/black_cleopatra.svg create mode 100644 pieces/Benedict/black_cleopatra_TODO.svg mode change 100644 => 120000 pieces/Benedict/white_cleopatra.svg create mode 100644 pieces/Benedict/white_cleopatra_TODO.svg rename {variants => pieces}/Chakart/CREDITS (97%) create mode 100644 variants/Alice/class.js create mode 100644 variants/Alice/rules.html create mode 100644 variants/Alice/style.css delete mode 100644 variants/Ambiguous/CREDITS delete mode 100644 variants/Benedict/CREDITS diff --git a/base_rules.js b/base_rules.js index 4b387b6..a48bd3d 100644 --- a/base_rules.js +++ b/base_rules.js @@ -1082,8 +1082,9 @@ export default class ChessRules { } // Piece type on square (i,j) - getPieceType(i, j) { - const p = this.getPiece(i, j); + getPieceType(i, j, p) { + if (!p) + p = this.getPiece(i, j); return C.CannibalKings[p] || p; //a cannibal king move as... } @@ -1092,7 +1093,7 @@ export default class ChessRules { return (color == "w" ? "b" : "w"); } - // Can thing on square1 capture (no return) thing on square2? + // Can thing on square1 capture (enemy) thing on square2? canTake([x1, y1], [x2, y2]) { return (this.getColor(x1, y1) !== this.getColor(x2, y2)); } @@ -1214,6 +1215,8 @@ export default class ChessRules { if (this.board[i][j] != "" && this.getColor(i, j) == color) { const allSpecs = this.pieces(color, i, j) let specs = allSpecs[this.getPieceType(i, j)]; + if (specs.moveas) + specs = allSpecs[specs.moveas]; const attacks = specs.attack || specs.moves; for (let a of attacks) { outerLoop: for (let step of a.steps) { @@ -1482,7 +1485,10 @@ export default class ChessRules { const color = this.getColor(x, y); const oppCol = C.GetOppCol(color); const piece = this.getPieceType(x, y); //ok not cannibal king - const stepSpec = this.pieces(color, x, y)[piece]; + const allSpecs = this.pieces(color, x, y); + let stepSpec = allSpecs[piece]; + if (stepSpec.moveas) + stepSpec = allSpecs[stepSpec.moveas]; const attacks = stepSpec.attack || stepSpec.moves; for (let a of attacks) { outerLoop: for (let step of a.steps) { @@ -1506,7 +1512,7 @@ export default class ChessRules { return false; } - canStepOver(i, j) { + canStepOver(i, j, p) { // In some variants, objects on boards don't stop movement (Chakart) return this.board[i][j] == ""; } @@ -1514,7 +1520,11 @@ export default class ChessRules { // Generic method to find possible moves of "sliding or jumping" pieces getPotentialMovesOf(piece, [x, y]) { const color = this.getColor(x, y); - const stepSpec = this.pieces(color, x, y)[piece]; + const apparentPiece = this.getPiece(x, y); //how it looks + const allSpecs = this.pieces(color, x, y); + let stepSpec = allSpecs[piece]; + if (stepSpec.moveas) + stepSpec = allSpecs[stepSpec.moveas]; let moves = []; // Next 3 for Cylinder mode: let explored = {}; @@ -1539,7 +1549,7 @@ export default class ChessRules { let stepCounter = 0; while ( this.onBoard(i, j) && - (this.canStepOver(i, j) || (i == x && j == y)) + ((i == x && j == y) || this.canStepOver(i, j, apparentPiece)) ) { if ( type != "attack" && @@ -1610,8 +1620,14 @@ export default class ChessRules { ) { if (args.zen && this.isKing(this.getPiece(i, j))) continue; //king not captured in this way - const stepSpec = - this.pieces(args.oppCol, i, j)[this.getPieceType(i, j)]; + const apparentPiece = this.getPiece(i, j); + // Quick check: does this potential attacker target x,y ? + if (this.canStepOver(x, y, apparentPiece)) + continue; + const allSpecs = this.pieces(args.oppCol, i, j); + let stepSpec = allSpecs[this.getPieceType(i, j)]; + if (stepSpec.moveas) + stepSpec = allSpecs[stepSpec.moveas]; const attacks = stepSpec.attack || stepSpec.moves; for (let a of attacks) { for (let s of a.steps) { @@ -1754,8 +1770,15 @@ export default class ChessRules { s.y == e.y && Math.abs(s.x - e.x) == 2 && // Next conditions for variants like Atomic or Rifle, Recycle... - (move.appear.length > 0 && move.appear[0].p == "p") && - (move.vanish.length > 0 && move.vanish[0].p == "p") + ( + move.appear.length > 0 && + this.getPieceType(0, 0, move.appear[0].p) == "p" + ) + && + ( + move.vanish.length > 0 && + this.getPieceType(0, 0, move.vanish[0].p) == "p" + ) ) { return { x: (s.x + e.x) / 2, @@ -1945,12 +1968,12 @@ export default class ChessRules { let square = kingPos, res = true; //a priori valid if (m.vanish.some(v => { - return C.CannibalKings[v.p] && v.c == color; + return this.isKing(v.p) && v.c == color; })) { // Search king in appear array: const newKingIdx = m.appear.findIndex(a => { - return C.CannibalKings[a.p] && a.c == color; + return this.isKing(a.p) && a.c == color; }); if (newKingIdx >= 0) square = [m.appear[newKingIdx].x, m.appear[newKingIdx].y]; diff --git a/pieces/Ambiguous/red_target.svg b/pieces/Ambiguous/red_target.svg new file mode 100644 index 0000000..2f7bb8c --- /dev/null +++ b/pieces/Ambiguous/red_target.svg @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + version="1.1" + width="225.85715" + height="225.85715" + id="svg2" + inkscape:version="1.2 (dc2aedaf03, 2022-05-15)" + sodipodi:docname="red_target.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <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="namedview2990" + showgrid="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="1.2685914" + inkscape:cx="152.13724" + inkscape:cy="79.221726" + inkscape:window-x="0" + inkscape:window-y="20" + inkscape:window-maximized="0" + inkscape:current-layer="svg2" + inkscape:showpageshadow="2" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" /> + <defs + id="defs4" /> + <metadata + id="metadata7"> + <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 /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + id="layer1" + transform="matrix(0.765,0,0,0.765,-144.98571,-263.7299)"> + <path + d="m 448.57143,492.36218 a 111.42857,111.42857 0 1 1 -222.85715,0 111.42858,111.42858 0 1 1 222.85715,0 z" + id="path2985" + style="fill:#999999;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + </g> + <path + style="fill:#ffd42a;fill-opacity:1;stroke-width:0.709448" + d="M 98.253109,195.36855 C 72.101041,190.62798 49.655143,173.69384 37.806532,149.76512 31.486582,137.00172 28.838716,124.20636 29.493188,109.59225 29.992734,98.437579 31.297656,92.034173 35.015538,82.493438 39.232174,71.672816 44.703151,63.331483 53.39125,54.476887 65.971412,41.655643 79.017127,34.506041 96.812275,30.680337 c 8.052815,-1.731243 24.202725,-1.709019 32.489945,0.04471 44.20641,9.354889 73.02732,50.616097 66.34089,94.976333 -5.27824,35.01769 -33.17237,63.55212 -68.07614,69.63883 -7.55013,1.31662 -22.12905,1.33072 -29.313861,0.0283 z" + id="path3711" + inkscape:connector-curvature="0" /> + <path + style="fill:#d40000;fill-opacity:1;stroke-width:0.709448" + d="m 95.958146,194.61919 c -30.908368,-6.632 -55.798902,-30.49583 -63.967769,-61.32918 -1.836228,-6.93083 -2.557292,-25.04818 -1.33076,-33.436485 3.922412,-26.825533 24.084774,-52.885283 49.159816,-63.53881 13.425863,-5.704191 30.062077,-7.910069 44.820597,-5.942985 32.36557,4.313837 60.55064,29.469457 68.98868,61.573513 2.23475,8.502527 3.02779,24.425807 1.67669,33.666037 -4.96162,33.93273 -32.48658,62.64582 -66.1808,69.0375 -7.24425,1.37421 -26.70496,1.35685 -33.166454,-0.0296 z" + id="path9" + inkscape:connector-curvature="0" /> +</svg> diff --git a/pieces/Ambiguous/target.svg b/pieces/Ambiguous/target.svg deleted file mode 100644 index 53f0ccc..0000000 --- a/pieces/Ambiguous/target.svg +++ /dev/null @@ -1,191 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns="http://www.w3.org/2000/svg" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns:ns1="http://sozi.baierouge.fr" - xmlns:xlink="http://www.w3.org/1999/xlink" - id="svg12417" - sodipodi:docname="target.svg" - viewBox="0 0 200.13 200.02" - version="1.1" - inkscape:version="0.48+devel r10958" - > - <title - id="title825" - >Target</title - > - <sodipodi:namedview - id="base" - fit-margin-left="10" - inkscape:zoom="1" - height="0px" - borderopacity="1.0" - inkscape:current-layer="layer1" - inkscape:cx="89.904323" - inkscape:cy="99.565238" - fit-margin-right="10" - inkscape:window-maximized="1" - showgrid="false" - width="0px" - inkscape:guide-bbox="true" - showguides="true" - bordercolor="#666666" - inkscape:window-x="-8" - inkscape:window-y="-8" - fit-margin-bottom="10" - inkscape:window-width="1280" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - pagecolor="#ffffff" - inkscape:document-units="px" - inkscape:window-height="962" - fit-margin-top="10" - /> - <g - id="layer1" - inkscape:label="Layer 1" - inkscape:groupmode="layer" - transform="translate(-248.44 -442.39)" - > - <g - id="g818" - transform="translate(-.96350 -1.0044)" - > - <path - id="path12427-9-3-9" - sodipodi:rx="180.62735" - sodipodi:ry="180.62735" - style="color:#000000;stroke:#000000;stroke-width:24.084;fill:none" - sodipodi:type="arc" - d="m531.77 557.68c0 99.758-80.87 180.63-180.63 180.63-99.758 0-180.63-80.87-180.63-180.63 0-99.758 80.87-180.63 180.63-180.63 99.758 0 180.63 80.87 180.63 180.63z" - transform="matrix(.41522 0 0 .41522 203.67 311.84)" - sodipodi:cy="557.68408" - sodipodi:cx="351.13956" - /> - <path - id="path12427-9-3-9-8-5" - sodipodi:rx="180.62735" - sodipodi:ry="180.62735" - style="color:#000000;stroke:#000000;stroke-width:40.139;fill:none" - sodipodi:type="arc" - d="m531.77 557.68c0 99.758-80.87 180.63-180.63 180.63-99.758 0-180.63-80.87-180.63-180.63 0-99.758 80.87-180.63 180.63-180.63 99.758 0 180.63 80.87 180.63 180.63z" - transform="matrix(.24913 0 0 .24913 261.99 404.46)" - sodipodi:cy="557.68408" - sodipodi:cx="351.13956" - /> - <path - id="path12427-9-3-9-8-2-3" - sodipodi:rx="180.62735" - sodipodi:ry="180.62735" - style="color:#000000;fill:#000000" - sodipodi:type="arc" - d="m531.77 557.68c0 99.758-80.87 180.63-180.63 180.63-99.758 0-180.63-80.87-180.63-180.63 0-99.758 80.87-180.63 180.63-180.63 99.758 0 180.63 80.87 180.63 180.63z" - transform="matrix(.12121 0 0 .12121 306.91 475.8)" - sodipodi:cy="557.68408" - sodipodi:cx="351.13956" - /> - <path - id="path13189-0" - d="m349.48 455.93v174.95" - style="stroke:#000000;stroke-linecap:round;stroke-width:5;fill:none" - inkscape:connector-curvature="0" - /> - <path - id="path45" - style="stroke:#000000;stroke-linecap:round;stroke-width:5;fill:none" - inkscape:connector-curvature="0" - d="m436.98 543.41h-174.95" - /> - </g - > - </g - > - <metadata - > - <rdf:RDF - > - <cc:Work - > - <dc:format - >image/svg+xml</dc:format - > - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" - /> - <cc:license - rdf:resource="http://creativecommons.org/licenses/publicdomain/" - /> - <dc:publisher - > - <cc:Agent - rdf:about="http://openclipart.org/" - > - <dc:title - >Openclipart</dc:title - > - </cc:Agent - > - </dc:publisher - > - <dc:title - >Target</dc:title - > - <dc:date - >2012-02-15T07:37:04</dc:date - > - <dc:description - >Target symbol</dc:description - > - <dc:source - >https://openclipart.org/detail/168253/target-by-fanda@cz</dc:source - > - <dc:creator - > - <cc:Agent - > - <dc:title - >Fanda@CZ</dc:title - > - </cc:Agent - > - </dc:creator - > - <dc:subject - > - <rdf:Bag - > - <rdf:li - >target</rdf:li - > - </rdf:Bag - > - </dc:subject - > - </cc:Work - > - <cc:License - rdf:about="http://creativecommons.org/licenses/publicdomain/" - > - <cc:permits - rdf:resource="http://creativecommons.org/ns#Reproduction" - /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#Distribution" - /> - <cc:permits - rdf:resource="http://creativecommons.org/ns#DerivativeWorks" - /> - </cc:License - > - </rdf:RDF - > - </metadata - > -</svg -> diff --git a/pieces/Ambiguous/yellow_target.svg b/pieces/Ambiguous/yellow_target.svg new file mode 100644 index 0000000..400b872 --- /dev/null +++ b/pieces/Ambiguous/yellow_target.svg @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + version="1.1" + width="225.85715" + height="225.85715" + id="svg2" + inkscape:version="1.2 (dc2aedaf03, 2022-05-15)" + sodipodi:docname="yellow_target.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + <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="namedview2990" + showgrid="false" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + inkscape:zoom="1.2685914" + inkscape:cx="150.56069" + inkscape:cy="79.221726" + inkscape:window-x="0" + inkscape:window-y="20" + inkscape:window-maximized="0" + inkscape:current-layer="svg2" + inkscape:showpageshadow="2" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" /> + <defs + id="defs4" /> + <metadata + id="metadata7"> + <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 /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + id="layer1" + transform="matrix(0.765,0,0,0.765,-144.98571,-263.7299)"> + <path + d="m 448.57143,492.36218 a 111.42857,111.42857 0 1 1 -222.85715,0 111.42858,111.42858 0 1 1 222.85715,0 z" + id="path2985" + style="fill:#999999;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + </g> + <path + style="fill:#ffd42a;fill-opacity:1;stroke-width:0.709448" + d="M 98.253109,195.36855 C 72.101041,190.62798 49.655143,173.69384 37.806532,149.76512 31.486582,137.00172 28.838716,124.20636 29.493188,109.59225 29.992734,98.437579 31.297656,92.034173 35.015538,82.493438 39.232174,71.672816 44.703151,63.331483 53.39125,54.476887 65.971412,41.655643 79.017127,34.506041 96.812275,30.680337 c 8.052815,-1.731243 24.202725,-1.709019 32.489945,0.04471 44.20641,9.354889 73.02732,50.616097 66.34089,94.976333 -5.27824,35.01769 -33.17237,63.55212 -68.07614,69.63883 -7.55013,1.31662 -22.12905,1.33072 -29.313861,0.0283 z" + id="path3711" + inkscape:connector-curvature="0" /> +</svg> diff --git a/pieces/Benedict/CREDITS b/pieces/Benedict/CREDITS new file mode 100644 index 0000000..7844bd6 --- /dev/null +++ b/pieces/Benedict/CREDITS @@ -0,0 +1,7 @@ +Unusable? +https://game-icons.net/1x1/delapouite/cleopatra.html +https://www.svgrepo.com/svg/322047/cleopatra + +PNG? or paying... +https://www.flaticon.com/free-icon/cleopatra_1393471 +https://www.flaticon.com/fr/icone-gratuite/cleopatre_1929899 diff --git a/pieces/Benedict/black_cleopatra.svg b/pieces/Benedict/black_cleopatra.svg deleted file mode 100644 index 4360044..0000000 --- a/pieces/Benedict/black_cleopatra.svg +++ /dev/null @@ -1 +0,0 @@ -<svg width="512px" height="512px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#000" d="M247.6 17l-14.4 94.6 14.9 59.7c2.9 2.8 5.6 5.5 7 6.7.6.4.7.4.9.6.2-.2.3-.2.9-.6 1.4-1.2 4.1-3.9 7-6.7l14.9-59.7L264.4 17h-16.8zm-18.7 10.61c-36.1 6.78-71.8 26.1-101.4 49.45-5.7 4.49-11.1 9.14-16.3 13.88 34.4 3.96 70 6.44 105.9 7.49l11.8-70.82zm54.1.03l11.9 70.76c35.9-1.02 71.5-3.49 105.8-7.44-5.2-4.75-10.7-9.4-16.4-13.9-29.6-23.32-65.1-42.61-101.3-49.42zM94.81 107.1c-9.8 10.4-18.14 20.7-24.63 30.2 52.52 5.3 103.12 8.4 153.22 9.4l-7.6-30.3c-41.2-1.3-81.9-4.3-120.99-9.3zm322.19 0c-39 5-79.7 8-120.8 9.2l-7.6 30.4c50.1-1 100.6-4.1 153.1-9.4-6.5-9.4-14.8-19.8-24.7-30.2zM60.08 154.3c-1.43 2.9-2.58 5.6-3.44 8.1-7.98 40.7-7.5 86.3-5.27 132.1 11.55 11.4 22.95 22 34.03 30.3 11 8.2 21.6 14.1 31.5 16.7 1.9-39.3 2-86.5 2-149.5v-13.3l12.3 4.9c77.7 31.1 171.7 31.1 249.4 0l12.3-4.9V192c0 63 .1 110.3 2 149.5 10-2.6 20.6-8.4 31.7-16.7 10.9-8.2 22.1-18.6 33.5-29.8 2.5-50.6 3.3-99.3-4.8-132.4-.9-2.5-2-5.3-3.5-8.3-57.6 6.1-112.9 9.5-167.7 10.4l-4 15.9-1.7 1.8c-4 4-7.1 7.1-10.3 9.6-3.2 2.6-7.1 5-12.1 5s-8.9-2.4-12.1-5c-3.2-2.5-6.3-5.6-10.3-9.6l-1.7-1.8-4-15.9c-54.9-.9-110.2-4.3-167.82-10.4zm76.82 50.6c0 22.4 0 42.9-.2 61.8 8.7-12.8 18.2-21.2 28.4-25.6 5.1-2.3 10.4-3.4 15.6-3.7 1.3-.1 2.5-.1 3.8-.1 3.8.1 7.6.6 11.3 1.4 19.3 4.5 35.8 17.4 49 25.7l-9.6 15.2c-6-3.8-12.3-8-18.6-11.8.3 1.4.4 2.8.4 4.2 0 13.7-11.3 25-25 25s-25-11.3-25-25c0-5.2 1.6-10 4.4-14-6.2 2.8-12.9 8.5-19.9 19l-14.8-9.9c-.1 17.4-.4 33.5-.8 48.5 6.9 24.8 16.8 47.1 29 65.5C189 417.6 221.2 439 256 439s67-21.4 91.1-57.9c12.1-18.3 22-40.4 28.8-65-.4-15.1-.7-31.3-.8-48.8l-14.6 9.7c-7-10.5-13.7-16.2-19.9-19 2.8 4 4.4 8.8 4.4 14 0 13.7-11.3 25-25 25s-25-11.3-25-25c0-1.4.1-2.8.4-4.2-6.3 3.8-12.6 8-18.6 11.8l-9.6-15.2c13.2-8.3 29.7-21.2 49-25.7 3.7-.8 7.5-1.3 11.3-1.4 1.3 0 2.5 0 3.8.1 5.2.3 10.5 1.4 15.6 3.7 10.1 4.3 19.6 12.6 28.2 25.3-.2-18.8-.2-39.2-.2-61.5-75.5 26.8-162.5 26.8-238 0zM192 265c-4 0-7 3-7 7s3 7 7 7 7-3 7-7-3-7-7-7zm128 0c-4 0-7 3-7 7s3 7 7 7 7-3 7-7-3-7-7-7zm-89.9 48.4c9.1 8.4 17.6 13 25.2 13.6 7.6.5 15.7-2.4 26.2-13.3l13 12.6c-12.9 13.3-26.9 19.6-40.5 18.6-13.6-.9-25.4-8.4-36.1-18.3l12.2-13.2zm-177.31 7.4c.8 13.8 1.64 27.5 2.35 41.1L112 398.7c1.6-12.3 2.9-25.2 3.8-39-14.4-2.9-28.06-10.6-41.2-20.5-7.37-5.5-14.63-11.8-21.81-18.4zm405.91.5c-7 6.4-14.1 12.5-21.3 17.9-13.2 9.9-26.9 17.7-41.4 20.6.9 13.8 2.2 26.7 3.9 39l56.7-36.8c.6-13.3 1.4-27 2.1-40.7zm-220.5 38.6c.6 0 1.2 0 1.8.1 7.5.7 16 12 16 12s8.5-11.3 16-12c19.1-1.9 48 24 48 24s-40.1 32-64 32-64-32-64-32 27.1-24.3 46.2-24.1zm-104.4 2.3c-1.4 19.5-3.4 37.2-6.2 54.3H170c-7.3-7.6-14.1-16.2-20.2-25.5-5.8-8.9-11.2-18.6-16-28.8zm244.2.3c-4.7 10.2-10 19.7-15.8 28.5-6.1 9.3-12.9 17.9-20.2 25.5h42.2c-2.8-17-4.8-34.6-6.2-54zM56.16 384.1c.34 8.9.58 17.7.65 26.3l48.79 24.4c1.2-5.5 2.3-11 3.3-16.5l-52.74-34.2zm399.44.1l-52.7 34.2c1 5.5 2.1 11 3.3 16.4l48.8-24.4c.1-8.4.3-17.2.6-26.2zm-262.3 52.3c-3.7 15-9.7 30.1-20.9 45.1L161.6 496h188.8l-10.8-14.4c-11.2-15-17.2-30.1-20.9-45.1-18.9 13.1-40.1 20.5-62.7 20.5s-43.8-7.4-62.7-20.5z"/></svg> \ No newline at end of file diff --git a/pieces/Benedict/black_cleopatra.svg b/pieces/Benedict/black_cleopatra.svg new file mode 120000 index 0000000..1669cd3 --- /dev/null +++ b/pieces/Benedict/black_cleopatra.svg @@ -0,0 +1 @@ +../black_queen.svg \ No newline at end of file diff --git a/pieces/Benedict/black_cleopatra_TODO.svg b/pieces/Benedict/black_cleopatra_TODO.svg new file mode 100644 index 0000000..4360044 --- /dev/null +++ b/pieces/Benedict/black_cleopatra_TODO.svg @@ -0,0 +1 @@ +<svg width="512px" height="512px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#000" d="M247.6 17l-14.4 94.6 14.9 59.7c2.9 2.8 5.6 5.5 7 6.7.6.4.7.4.9.6.2-.2.3-.2.9-.6 1.4-1.2 4.1-3.9 7-6.7l14.9-59.7L264.4 17h-16.8zm-18.7 10.61c-36.1 6.78-71.8 26.1-101.4 49.45-5.7 4.49-11.1 9.14-16.3 13.88 34.4 3.96 70 6.44 105.9 7.49l11.8-70.82zm54.1.03l11.9 70.76c35.9-1.02 71.5-3.49 105.8-7.44-5.2-4.75-10.7-9.4-16.4-13.9-29.6-23.32-65.1-42.61-101.3-49.42zM94.81 107.1c-9.8 10.4-18.14 20.7-24.63 30.2 52.52 5.3 103.12 8.4 153.22 9.4l-7.6-30.3c-41.2-1.3-81.9-4.3-120.99-9.3zm322.19 0c-39 5-79.7 8-120.8 9.2l-7.6 30.4c50.1-1 100.6-4.1 153.1-9.4-6.5-9.4-14.8-19.8-24.7-30.2zM60.08 154.3c-1.43 2.9-2.58 5.6-3.44 8.1-7.98 40.7-7.5 86.3-5.27 132.1 11.55 11.4 22.95 22 34.03 30.3 11 8.2 21.6 14.1 31.5 16.7 1.9-39.3 2-86.5 2-149.5v-13.3l12.3 4.9c77.7 31.1 171.7 31.1 249.4 0l12.3-4.9V192c0 63 .1 110.3 2 149.5 10-2.6 20.6-8.4 31.7-16.7 10.9-8.2 22.1-18.6 33.5-29.8 2.5-50.6 3.3-99.3-4.8-132.4-.9-2.5-2-5.3-3.5-8.3-57.6 6.1-112.9 9.5-167.7 10.4l-4 15.9-1.7 1.8c-4 4-7.1 7.1-10.3 9.6-3.2 2.6-7.1 5-12.1 5s-8.9-2.4-12.1-5c-3.2-2.5-6.3-5.6-10.3-9.6l-1.7-1.8-4-15.9c-54.9-.9-110.2-4.3-167.82-10.4zm76.82 50.6c0 22.4 0 42.9-.2 61.8 8.7-12.8 18.2-21.2 28.4-25.6 5.1-2.3 10.4-3.4 15.6-3.7 1.3-.1 2.5-.1 3.8-.1 3.8.1 7.6.6 11.3 1.4 19.3 4.5 35.8 17.4 49 25.7l-9.6 15.2c-6-3.8-12.3-8-18.6-11.8.3 1.4.4 2.8.4 4.2 0 13.7-11.3 25-25 25s-25-11.3-25-25c0-5.2 1.6-10 4.4-14-6.2 2.8-12.9 8.5-19.9 19l-14.8-9.9c-.1 17.4-.4 33.5-.8 48.5 6.9 24.8 16.8 47.1 29 65.5C189 417.6 221.2 439 256 439s67-21.4 91.1-57.9c12.1-18.3 22-40.4 28.8-65-.4-15.1-.7-31.3-.8-48.8l-14.6 9.7c-7-10.5-13.7-16.2-19.9-19 2.8 4 4.4 8.8 4.4 14 0 13.7-11.3 25-25 25s-25-11.3-25-25c0-1.4.1-2.8.4-4.2-6.3 3.8-12.6 8-18.6 11.8l-9.6-15.2c13.2-8.3 29.7-21.2 49-25.7 3.7-.8 7.5-1.3 11.3-1.4 1.3 0 2.5 0 3.8.1 5.2.3 10.5 1.4 15.6 3.7 10.1 4.3 19.6 12.6 28.2 25.3-.2-18.8-.2-39.2-.2-61.5-75.5 26.8-162.5 26.8-238 0zM192 265c-4 0-7 3-7 7s3 7 7 7 7-3 7-7-3-7-7-7zm128 0c-4 0-7 3-7 7s3 7 7 7 7-3 7-7-3-7-7-7zm-89.9 48.4c9.1 8.4 17.6 13 25.2 13.6 7.6.5 15.7-2.4 26.2-13.3l13 12.6c-12.9 13.3-26.9 19.6-40.5 18.6-13.6-.9-25.4-8.4-36.1-18.3l12.2-13.2zm-177.31 7.4c.8 13.8 1.64 27.5 2.35 41.1L112 398.7c1.6-12.3 2.9-25.2 3.8-39-14.4-2.9-28.06-10.6-41.2-20.5-7.37-5.5-14.63-11.8-21.81-18.4zm405.91.5c-7 6.4-14.1 12.5-21.3 17.9-13.2 9.9-26.9 17.7-41.4 20.6.9 13.8 2.2 26.7 3.9 39l56.7-36.8c.6-13.3 1.4-27 2.1-40.7zm-220.5 38.6c.6 0 1.2 0 1.8.1 7.5.7 16 12 16 12s8.5-11.3 16-12c19.1-1.9 48 24 48 24s-40.1 32-64 32-64-32-64-32 27.1-24.3 46.2-24.1zm-104.4 2.3c-1.4 19.5-3.4 37.2-6.2 54.3H170c-7.3-7.6-14.1-16.2-20.2-25.5-5.8-8.9-11.2-18.6-16-28.8zm244.2.3c-4.7 10.2-10 19.7-15.8 28.5-6.1 9.3-12.9 17.9-20.2 25.5h42.2c-2.8-17-4.8-34.6-6.2-54zM56.16 384.1c.34 8.9.58 17.7.65 26.3l48.79 24.4c1.2-5.5 2.3-11 3.3-16.5l-52.74-34.2zm399.44.1l-52.7 34.2c1 5.5 2.1 11 3.3 16.4l48.8-24.4c.1-8.4.3-17.2.6-26.2zm-262.3 52.3c-3.7 15-9.7 30.1-20.9 45.1L161.6 496h188.8l-10.8-14.4c-11.2-15-17.2-30.1-20.9-45.1-18.9 13.1-40.1 20.5-62.7 20.5s-43.8-7.4-62.7-20.5z"/></svg> \ No newline at end of file diff --git a/pieces/Benedict/white_cleopatra.svg b/pieces/Benedict/white_cleopatra.svg deleted file mode 100644 index fd7f323..0000000 --- a/pieces/Benedict/white_cleopatra.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="#000" fill-opacity="1"></path><g class="" transform="translate(0,0)" style=""><path d="M247.6 17l-14.4 94.6 14.9 59.7c2.9 2.8 5.6 5.5 7 6.7.6.4.7.4.9.6.2-.2.3-.2.9-.6 1.4-1.2 4.1-3.9 7-6.7l14.9-59.7L264.4 17h-16.8zm-18.7 10.61c-36.1 6.78-71.8 26.1-101.4 49.45-5.7 4.49-11.1 9.14-16.3 13.88 34.4 3.96 70 6.44 105.9 7.49l11.8-70.82zm54.1.03l11.9 70.76c35.9-1.02 71.5-3.49 105.8-7.44-5.2-4.75-10.7-9.4-16.4-13.9-29.6-23.32-65.1-42.61-101.3-49.42zM94.81 107.1c-9.8 10.4-18.14 20.7-24.63 30.2 52.52 5.3 103.12 8.4 153.22 9.4l-7.6-30.3c-41.2-1.3-81.9-4.3-120.99-9.3zm322.19 0c-39 5-79.7 8-120.8 9.2l-7.6 30.4c50.1-1 100.6-4.1 153.1-9.4-6.5-9.4-14.8-19.8-24.7-30.2zM60.08 154.3c-1.43 2.9-2.58 5.6-3.44 8.1-7.98 40.7-7.5 86.3-5.27 132.1 11.55 11.4 22.95 22 34.03 30.3 11 8.2 21.6 14.1 31.5 16.7 1.9-39.3 2-86.5 2-149.5v-13.3l12.3 4.9c77.7 31.1 171.7 31.1 249.4 0l12.3-4.9V192c0 63 .1 110.3 2 149.5 10-2.6 20.6-8.4 31.7-16.7 10.9-8.2 22.1-18.6 33.5-29.8 2.5-50.6 3.3-99.3-4.8-132.4-.9-2.5-2-5.3-3.5-8.3-57.6 6.1-112.9 9.5-167.7 10.4l-4 15.9-1.7 1.8c-4 4-7.1 7.1-10.3 9.6-3.2 2.6-7.1 5-12.1 5s-8.9-2.4-12.1-5c-3.2-2.5-6.3-5.6-10.3-9.6l-1.7-1.8-4-15.9c-54.9-.9-110.2-4.3-167.82-10.4zm76.82 50.6c0 22.4 0 42.9-.2 61.8 8.7-12.8 18.2-21.2 28.4-25.6 5.1-2.3 10.4-3.4 15.6-3.7 1.3-.1 2.5-.1 3.8-.1 3.8.1 7.6.6 11.3 1.4 19.3 4.5 35.8 17.4 49 25.7l-9.6 15.2c-6-3.8-12.3-8-18.6-11.8.3 1.4.4 2.8.4 4.2 0 13.7-11.3 25-25 25s-25-11.3-25-25c0-5.2 1.6-10 4.4-14-6.2 2.8-12.9 8.5-19.9 19l-14.8-9.9c-.1 17.4-.4 33.5-.8 48.5 6.9 24.8 16.8 47.1 29 65.5C189 417.6 221.2 439 256 439s67-21.4 91.1-57.9c12.1-18.3 22-40.4 28.8-65-.4-15.1-.7-31.3-.8-48.8l-14.6 9.7c-7-10.5-13.7-16.2-19.9-19 2.8 4 4.4 8.8 4.4 14 0 13.7-11.3 25-25 25s-25-11.3-25-25c0-1.4.1-2.8.4-4.2-6.3 3.8-12.6 8-18.6 11.8l-9.6-15.2c13.2-8.3 29.7-21.2 49-25.7 3.7-.8 7.5-1.3 11.3-1.4 1.3 0 2.5 0 3.8.1 5.2.3 10.5 1.4 15.6 3.7 10.1 4.3 19.6 12.6 28.2 25.3-.2-18.8-.2-39.2-.2-61.5-75.5 26.8-162.5 26.8-238 0zM192 265c-4 0-7 3-7 7s3 7 7 7 7-3 7-7-3-7-7-7zm128 0c-4 0-7 3-7 7s3 7 7 7 7-3 7-7-3-7-7-7zm-89.9 48.4c9.1 8.4 17.6 13 25.2 13.6 7.6.5 15.7-2.4 26.2-13.3l13 12.6c-12.9 13.3-26.9 19.6-40.5 18.6-13.6-.9-25.4-8.4-36.1-18.3l12.2-13.2zm-177.31 7.4c.8 13.8 1.64 27.5 2.35 41.1L112 398.7c1.6-12.3 2.9-25.2 3.8-39-14.4-2.9-28.06-10.6-41.2-20.5-7.37-5.5-14.63-11.8-21.81-18.4zm405.91.5c-7 6.4-14.1 12.5-21.3 17.9-13.2 9.9-26.9 17.7-41.4 20.6.9 13.8 2.2 26.7 3.9 39l56.7-36.8c.6-13.3 1.4-27 2.1-40.7zm-220.5 38.6c.6 0 1.2 0 1.8.1 7.5.7 16 12 16 12s8.5-11.3 16-12c19.1-1.9 48 24 48 24s-40.1 32-64 32-64-32-64-32 27.1-24.3 46.2-24.1zm-104.4 2.3c-1.4 19.5-3.4 37.2-6.2 54.3H170c-7.3-7.6-14.1-16.2-20.2-25.5-5.8-8.9-11.2-18.6-16-28.8zm244.2.3c-4.7 10.2-10 19.7-15.8 28.5-6.1 9.3-12.9 17.9-20.2 25.5h42.2c-2.8-17-4.8-34.6-6.2-54zM56.16 384.1c.34 8.9.58 17.7.65 26.3l48.79 24.4c1.2-5.5 2.3-11 3.3-16.5l-52.74-34.2zm399.44.1l-52.7 34.2c1 5.5 2.1 11 3.3 16.4l48.8-24.4c.1-8.4.3-17.2.6-26.2zm-262.3 52.3c-3.7 15-9.7 30.1-20.9 45.1L161.6 496h188.8l-10.8-14.4c-11.2-15-17.2-30.1-20.9-45.1-18.9 13.1-40.1 20.5-62.7 20.5s-43.8-7.4-62.7-20.5z" fill="#fff" fill-opacity="1"></path></g></svg> \ No newline at end of file diff --git a/pieces/Benedict/white_cleopatra.svg b/pieces/Benedict/white_cleopatra.svg new file mode 120000 index 0000000..e31fd1d --- /dev/null +++ b/pieces/Benedict/white_cleopatra.svg @@ -0,0 +1 @@ +../white_queen.svg \ No newline at end of file diff --git a/pieces/Benedict/white_cleopatra_TODO.svg b/pieces/Benedict/white_cleopatra_TODO.svg new file mode 100644 index 0000000..fd7f323 --- /dev/null +++ b/pieces/Benedict/white_cleopatra_TODO.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="height: 512px; width: 512px;"><path d="M0 0h512v512H0z" fill="#000" fill-opacity="1"></path><g class="" transform="translate(0,0)" style=""><path d="M247.6 17l-14.4 94.6 14.9 59.7c2.9 2.8 5.6 5.5 7 6.7.6.4.7.4.9.6.2-.2.3-.2.9-.6 1.4-1.2 4.1-3.9 7-6.7l14.9-59.7L264.4 17h-16.8zm-18.7 10.61c-36.1 6.78-71.8 26.1-101.4 49.45-5.7 4.49-11.1 9.14-16.3 13.88 34.4 3.96 70 6.44 105.9 7.49l11.8-70.82zm54.1.03l11.9 70.76c35.9-1.02 71.5-3.49 105.8-7.44-5.2-4.75-10.7-9.4-16.4-13.9-29.6-23.32-65.1-42.61-101.3-49.42zM94.81 107.1c-9.8 10.4-18.14 20.7-24.63 30.2 52.52 5.3 103.12 8.4 153.22 9.4l-7.6-30.3c-41.2-1.3-81.9-4.3-120.99-9.3zm322.19 0c-39 5-79.7 8-120.8 9.2l-7.6 30.4c50.1-1 100.6-4.1 153.1-9.4-6.5-9.4-14.8-19.8-24.7-30.2zM60.08 154.3c-1.43 2.9-2.58 5.6-3.44 8.1-7.98 40.7-7.5 86.3-5.27 132.1 11.55 11.4 22.95 22 34.03 30.3 11 8.2 21.6 14.1 31.5 16.7 1.9-39.3 2-86.5 2-149.5v-13.3l12.3 4.9c77.7 31.1 171.7 31.1 249.4 0l12.3-4.9V192c0 63 .1 110.3 2 149.5 10-2.6 20.6-8.4 31.7-16.7 10.9-8.2 22.1-18.6 33.5-29.8 2.5-50.6 3.3-99.3-4.8-132.4-.9-2.5-2-5.3-3.5-8.3-57.6 6.1-112.9 9.5-167.7 10.4l-4 15.9-1.7 1.8c-4 4-7.1 7.1-10.3 9.6-3.2 2.6-7.1 5-12.1 5s-8.9-2.4-12.1-5c-3.2-2.5-6.3-5.6-10.3-9.6l-1.7-1.8-4-15.9c-54.9-.9-110.2-4.3-167.82-10.4zm76.82 50.6c0 22.4 0 42.9-.2 61.8 8.7-12.8 18.2-21.2 28.4-25.6 5.1-2.3 10.4-3.4 15.6-3.7 1.3-.1 2.5-.1 3.8-.1 3.8.1 7.6.6 11.3 1.4 19.3 4.5 35.8 17.4 49 25.7l-9.6 15.2c-6-3.8-12.3-8-18.6-11.8.3 1.4.4 2.8.4 4.2 0 13.7-11.3 25-25 25s-25-11.3-25-25c0-5.2 1.6-10 4.4-14-6.2 2.8-12.9 8.5-19.9 19l-14.8-9.9c-.1 17.4-.4 33.5-.8 48.5 6.9 24.8 16.8 47.1 29 65.5C189 417.6 221.2 439 256 439s67-21.4 91.1-57.9c12.1-18.3 22-40.4 28.8-65-.4-15.1-.7-31.3-.8-48.8l-14.6 9.7c-7-10.5-13.7-16.2-19.9-19 2.8 4 4.4 8.8 4.4 14 0 13.7-11.3 25-25 25s-25-11.3-25-25c0-1.4.1-2.8.4-4.2-6.3 3.8-12.6 8-18.6 11.8l-9.6-15.2c13.2-8.3 29.7-21.2 49-25.7 3.7-.8 7.5-1.3 11.3-1.4 1.3 0 2.5 0 3.8.1 5.2.3 10.5 1.4 15.6 3.7 10.1 4.3 19.6 12.6 28.2 25.3-.2-18.8-.2-39.2-.2-61.5-75.5 26.8-162.5 26.8-238 0zM192 265c-4 0-7 3-7 7s3 7 7 7 7-3 7-7-3-7-7-7zm128 0c-4 0-7 3-7 7s3 7 7 7 7-3 7-7-3-7-7-7zm-89.9 48.4c9.1 8.4 17.6 13 25.2 13.6 7.6.5 15.7-2.4 26.2-13.3l13 12.6c-12.9 13.3-26.9 19.6-40.5 18.6-13.6-.9-25.4-8.4-36.1-18.3l12.2-13.2zm-177.31 7.4c.8 13.8 1.64 27.5 2.35 41.1L112 398.7c1.6-12.3 2.9-25.2 3.8-39-14.4-2.9-28.06-10.6-41.2-20.5-7.37-5.5-14.63-11.8-21.81-18.4zm405.91.5c-7 6.4-14.1 12.5-21.3 17.9-13.2 9.9-26.9 17.7-41.4 20.6.9 13.8 2.2 26.7 3.9 39l56.7-36.8c.6-13.3 1.4-27 2.1-40.7zm-220.5 38.6c.6 0 1.2 0 1.8.1 7.5.7 16 12 16 12s8.5-11.3 16-12c19.1-1.9 48 24 48 24s-40.1 32-64 32-64-32-64-32 27.1-24.3 46.2-24.1zm-104.4 2.3c-1.4 19.5-3.4 37.2-6.2 54.3H170c-7.3-7.6-14.1-16.2-20.2-25.5-5.8-8.9-11.2-18.6-16-28.8zm244.2.3c-4.7 10.2-10 19.7-15.8 28.5-6.1 9.3-12.9 17.9-20.2 25.5h42.2c-2.8-17-4.8-34.6-6.2-54zM56.16 384.1c.34 8.9.58 17.7.65 26.3l48.79 24.4c1.2-5.5 2.3-11 3.3-16.5l-52.74-34.2zm399.44.1l-52.7 34.2c1 5.5 2.1 11 3.3 16.4l48.8-24.4c.1-8.4.3-17.2.6-26.2zm-262.3 52.3c-3.7 15-9.7 30.1-20.9 45.1L161.6 496h188.8l-10.8-14.4c-11.2-15-17.2-30.1-20.9-45.1-18.9 13.1-40.1 20.5-62.7 20.5s-43.8-7.4-62.7-20.5z" fill="#fff" fill-opacity="1"></path></g></svg> \ No newline at end of file diff --git a/variants/Chakart/CREDITS b/pieces/Chakart/CREDITS similarity index 97% rename from variants/Chakart/CREDITS rename to pieces/Chakart/CREDITS index 53a9181..11b0bb7 100644 --- a/variants/Chakart/CREDITS +++ b/pieces/Chakart/CREDITS @@ -1,5 +1,3 @@ -Images: - https://fr.m.wikiversity.org/wiki/Fichier:Tango_Style_Mushroom_icon.svg https://commons.wikimedia.org/wiki/File:Tux_Paint_banana.svg https://www.onlinewebfonts.com/icon/425540 diff --git a/variants.js b/variants.js index 59a69c0..8918f47 100644 --- a/variants.js +++ b/variants.js @@ -1,7 +1,7 @@ const variants = [ {name: 'Absorption', desc: 'Absorb powers'}, {name: 'Alapo', desc: 'Geometric Chess'}, -// {name: 'Alice', desc: 'Both sides of the mirror'}, + {name: 'Alice', desc: 'Both sides of the mirror'}, // {name: 'Align4', desc: 'Align four pawns'}, // {name: 'Allmate', desc: 'Mate any piece'}, {name: 'Ambiguous', desc: "Play opponent's pieces"}, diff --git a/variants/Alapo/class.js b/variants/Alapo/class.js index eb0e73f..540747d 100644 --- a/variants/Alapo/class.js +++ b/variants/Alapo/class.js @@ -81,15 +81,14 @@ export default class AlapoRules extends ChessRules { ); } + // Triangles are rotated from opponent viewpoint (=> suffix "_inv") pieces(color, x, y) { + const allSpecs = super.pieces(color, x, y); return { - 'r': super.pieces(color, x, y)['r'], - 'q': super.pieces(color, x, y)['q'], - 'b': { - // Triangle is rotated from opponent viewpoint - "class": "bishop" + (this.playerColor != color ? "_inv" : ""), - moves: [ { steps: [[1, 1], [1, -1], [-1, 1], [-1, -1]] } ] - }, + 'r': allSpecs['r'], + 'q': allSpecs['q'], + 'b': Object.assign({}, allSpecs['b'], + {"class": "bishop" + (this.playerColor != color ? "_inv" : "")}), 's': { //"square" "class": "babyrook", moves: [ diff --git a/variants/Alapo/rules.html b/variants/Alapo/rules.html index 252699c..9ec57e0 100644 --- a/variants/Alapo/rules.html +++ b/variants/Alapo/rules.html @@ -5,3 +5,5 @@ <a href="https://www.chessvariants.com/small.dir/alapo.html"> chessvariants page. </a> + +<p class="author">Johannes Tranelis (1982).</p> diff --git a/variants/Alice/class.js b/variants/Alice/class.js new file mode 100644 index 0000000..1957383 --- /dev/null +++ b/variants/Alice/class.js @@ -0,0 +1,126 @@ +import ChessRules from "/base_rules.js"; +import { ArrayFun } from "/utils/array.js"; + +export default class AliceRules extends ChessRules { + + static get Options() { + return { + select: C.Options.select, + input: C.Options.input, + styles: [ + "balance", + "capture", + "cylinder", + "dark", + "doublemove", + "progressive", + "zen" + ] + }; + } + + // To the other side of the mirror and back... + static get ALICE_PIECES() { + return { + s: "p", + u: "r", + o: "n", + c: "b", + t: "q", + l: "k" + }; + } + static get ALICE_CODES() { + return { + p: "s", + r: "u", + n: "o", + b: "c", + q: "t", + k: "l" + }; + } + + getPieceType(x, y, p) { + if (!p) + p = super.getPiece(x, y); + return V.ALICE_PIECES[p] || p; + } + + pieces(color, x, y) { + let alices = { + 's': {"class": "alice-pawn", "moveas": "p"}, + 'u': {"class": "alice-rook", "moveas": "r"}, + 'o': {"class": "alice-knight", "moveas": "n"}, + 'c': {"class": "alice-bishop", "moveas": "b"}, + 't': {"class": "alice-queen", "moveas": "q"}, + 'l': {"class": "alice-king", "moveas": "k"} + }; + return Object.assign(alices, super.pieces(color, x, y)); + } + + fromSameWorld(p1, p2) { + return ( + (V.ALICE_PIECES[p1] && V.ALICE_PIECES[p2]) || + (V.ALICE_CODES[p1] && V.ALICE_CODES[p2]) + ); + } + + // Step of p over i,j ? + canStepOver(i, j, p) { + return ( + this.board[i][j] == "" || !this.fromSameWorld(this.getPiece(i, j), p)); + } + + // NOTE: castle & enPassant + // https://www.chessvariants.com/other.dir/alice.html + getPotentialMovesFrom([x, y]) { + return super.getPotentialMovesFrom([x, y]).filter(m => { + // Remove moves landing on occupied square on other board + return ( + this.board[m.end.x][m.end.y] == "" || + this.fromSameWorld(m.vanish[0].p, m.vanish[1].p) + ); + }).map(m => { + // Apply Alice rule: go to the other side of the mirror + if (Object.keys(V.ALICE_CODES).includes(m.vanish[0].p)) + // Board 1 + m.appear.forEach(a => a.p = V.ALICE_CODES[a.p]) + else + // Board 2 + m.appear.forEach(a => a.p = V.ALICE_PIECES[a.p]) + return m; + }); + } + + isKing(symbol) { + return ['k', 'l'].includes(symbol); + } + + getCurrentScore() { + const color = this.turn; + const inCheck = this.underCheck(this.searchKingPos(color)); + let someLegalMove = false; + // Search for legal moves: if any is found and + // does not change king world (if under check), then game not over. + for (let i=0; i<this.size.x; i++) { + for (let j=0; j<this.size.y; j++) { + if (this.getColor(i, j) == color) { + const moves = this.filterValid(this.getPotentialMovesFrom([i, j])); + if ( + moves.length >= 1 && + ( + !inCheck || + moves.some(m => m.vanish.every(v => !this.isKing(v.p))) + ) + ) { + return "*"; + } + } + } + } + // Couldn't find any legal move + return (inCheck ? "1/2" : (color == 'w' ? "0-1" : "1-0")); + } + +}; diff --git a/variants/Alice/rules.html b/variants/Alice/rules.html new file mode 100644 index 0000000..98659ea --- /dev/null +++ b/variants/Alice/rules.html @@ -0,0 +1,7 @@ +<p>Pieces move to the next board after playing (other side of the mirror).</p> + +<a href="https://www.chessvariants.com/other.dir/alice.html"> + chessvariants page. +</a> + +<p class="author">Vernon R. Parton (1953).</p> diff --git a/variants/Alice/style.css b/variants/Alice/style.css new file mode 100644 index 0000000..2683462 --- /dev/null +++ b/variants/Alice/style.css @@ -0,0 +1,39 @@ +@import url("/base_pieces.css"); + +piece.white.alice-pawn { + background-image: url('/pieces/yellow_pawn.svg'); +} +piece.white.alice-rook { + background-image: url('/pieces/yellow_rook.svg'); +} +piece.white.alice-knight { + background-image: url('/pieces/yellow_knight.svg'); +} +piece.white.alice-bishop { + background-image: url('/pieces/yellow_bishop.svg'); +} +piece.white.alice-queen { + background-image: url('/pieces/yellow_queen.svg'); +} +piece.white.alice-king { + background-image: url('/pieces/yellow_king.svg'); +} + +piece.black.alice-pawn { + background-image: url('/pieces/red_pawn.svg'); +} +piece.black.alice-rook { + background-image: url('/pieces/red_rook.svg'); +} +piece.black.alice-knight { + background-image: url('/pieces/red_knight.svg'); +} +piece.black.alice-bishop { + background-image: url('/pieces/red_bishop.svg'); +} +piece.black.alice-queen { + background-image: url('/pieces/red_queen.svg'); +} +piece.black.alice-king { + background-image: url('/pieces/red_king.svg'); +} diff --git a/variants/Ambiguous/CREDITS b/variants/Ambiguous/CREDITS deleted file mode 100644 index 68ab598..0000000 --- a/variants/Ambiguous/CREDITS +++ /dev/null @@ -1,3 +0,0 @@ -Images: - -https://freesvg.org/black-target diff --git a/variants/Ambiguous/class.js b/variants/Ambiguous/class.js index 6a001a6..58458b6 100644 --- a/variants/Ambiguous/class.js +++ b/variants/Ambiguous/class.js @@ -55,14 +55,10 @@ export default class AmbiguousRules extends ChessRules { return true; }) .map(m => { - if (m.vanish.length == 1) { - m.appear[0].c = 'a'; //a-color + if (m.vanish.length == 1) m.appear[0].p = V.GOAL; - } - else { + else m.appear[0].p = V.TARGET_CODE[m.vanish[1].p]; - m.appear[0].c = oppCol; - } m.vanish.shift(); return m; }) @@ -133,8 +129,8 @@ export default class AmbiguousRules extends ChessRules { 't': {"class": "target-queen", moves: []}, 'l': {"class": "target-king", moves: []} }; - return Object.assign( - { 'g': {"class": "target"} }, targets, super.pieces(color, x, y)); + return Object.assign({ 'g': {"class": "target", moves: []} }, + targets, super.pieces(color, x, y)); } atLeastOneMove() { diff --git a/variants/Ambiguous/style.css b/variants/Ambiguous/style.css index db300f7..f8dac72 100644 --- a/variants/Ambiguous/style.css +++ b/variants/Ambiguous/style.css @@ -1,7 +1,10 @@ @import url("/base_pieces.css"); -piece.target { - background-image: url('/pieces/Ambiguous/target.svg'); +piece.white.target { + background-image: url('/pieces/Ambiguous/yellow_target.svg'); +} +piece.black.target { + background-image: url('/pieces/Ambiguous/red_target.svg'); } piece.white.target-pawn { diff --git a/variants/Benedict/CREDITS b/variants/Benedict/CREDITS deleted file mode 100644 index e936f02..0000000 --- a/variants/Benedict/CREDITS +++ /dev/null @@ -1,4 +0,0 @@ -Images: - -https://game-icons.net/1x1/delapouite/cleopatra.html -https://www.svgrepo.com/svg/322047/cleopatra diff --git a/variants/Benedict/class.js b/variants/Benedict/class.js index 2bc60e7..e055e86 100644 --- a/variants/Benedict/class.js +++ b/variants/Benedict/class.js @@ -36,19 +36,11 @@ export default class BenedictRules extends ChessRules { pieces(color, x, y) { if (!this.options["cleopatra"]) return super.pieces(color, x, y); - return Object.assign({}, super.pieces(color, x, y), { - 'q': { - "class": "cleopatra", - moves: [ - { - steps: [ - [0, 1], [0, -1], [1, 0], [-1, 0], - [1, 1], [1, -1], [-1, 1], [-1, -1] - ] - } - ] - }, - }); + const allSpecs = super.pieces(color, x, y); + return Object.assign({}, + allSpecs, + {'q': Object.assign({}, allSpecs['q'], {"class": "cleopatra"})} + ); } // Find potential captures from a square -- 2.44.0