From 306dab5f2087a35669a114587c0415b31145665b Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Wed, 15 Jul 2020 14:54:13 +0200 Subject: [PATCH] Flip knights for variants with knightriders (waiting for a better image) --- client/public/images/pieces/Enpassant/bn.svg | 93 +++++++++++++++++++ client/public/images/pieces/Enpassant/wn.svg | 64 +++++++++++++ .../src/translations/rules/Monochrome/en.pug | 3 +- .../src/translations/rules/Monochrome/es.pug | 3 +- .../src/translations/rules/Monochrome/fr.pug | 3 +- client/src/variants/Enpassant.js | 4 + client/src/variants/Monochrome.js | 6 ++ client/src/variants/Royalrace.js | 4 + 8 files changed, 174 insertions(+), 6 deletions(-) create mode 100644 client/public/images/pieces/Enpassant/bn.svg create mode 100644 client/public/images/pieces/Enpassant/wn.svg diff --git a/client/public/images/pieces/Enpassant/bn.svg b/client/public/images/pieces/Enpassant/bn.svg new file mode 100644 index 00000000..1f94d604 --- /dev/null +++ b/client/public/images/pieces/Enpassant/bn.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + inkscape:version="1.0 (4035a4fb49, 2020-05-01)" + sodipodi:docname="bn.svg" + id="svg18" + viewBox="0 0 2048 2048" + version="1.1" + width="100%" + height="100%"> + <metadata + id="metadata24"> + <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="defs22" /> + <sodipodi:namedview + inkscape:current-layer="svg18" + inkscape:window-maximized="0" + inkscape:window-y="20" + inkscape:window-x="0" + inkscape:cy="1024" + inkscape:cx="1024" + inkscape:zoom="0.35888672" + showgrid="false" + id="namedview20" + inkscape:window-height="1180" + inkscape:window-width="960" + inkscape:pageshadow="2" + inkscape:pageopacity="0" + guidetolerance="10" + gridtolerance="10" + objecttolerance="10" + borderopacity="1" + bordercolor="#666666" + pagecolor="#ffffff" /> + <path + id="path2" + fill="#000000" + display="block" + fill-rule="nonzero" + d="m 490,643 q 4,9 13,27 17,42 17,50 -2,28 -29,28 -20,0 -47,-57 -4,-8 -12,-14 -27,-28 8,-47 32,-19 50,13 z m 590,371 q 70,92 69,205 -4,33 -38,33 -46,0 -36,-34 3,-55 -11,-91 -23,-57 -51,-85 -15,-30 18,-44 32,-15 49,16 z m -261,488 q -5,36 2,78 -60,-12 -113,-56 -32,-17 -15,-47 17,-31 47,-10 21,11 38,20 17,9 41,15 z M 1756,234 q -1,0 2,54 3,54 3,118 1,125 0,258 -1,133 -36,267 -34,128 -75,218 -41,90 -89,157 -72,108 -196,183 -124,75 -259,98 4,-23 3,-47 -1,-24 0,-46 97,-33 183,-82 86,-49 126,-106 48,-66 89,-156 41,-90 75,-219 34,-133 35,-266 1,-133 1,-259 0,-63 -3,-117 -3,-54 0,-55 z m -677,1423 q 157,-10 291,-81 134,-71 228,-182 66,-78 124,-188 58,-110 94,-233 40,-143 50,-300 10,-157 11,-292 V 163 q 0,0 -155,0 -155,0 -404,0 H 647 q -9,0 -9,49 0,49 7,79 4,24 19,68 15,44 50,107 16,32 76,93 60,61 138,143 45,46 70,116 25,70 22,127 -37,-30 -81,-49 -212,-76 -307,-220 -7,-9 -45,-81 -20,-38 -34,-52 -19,-19 -55,-21 -56,-3 -87,54 -42,-12 -75,-10 -56,21 -81,45 -51,51 -66,102 -15,51 -16,110 0,84 104,222 122,159 130,242 0,36 7,81 6,31 25,60 13,20 17,27 4,7 17,23 9,12 15,18 6,6 15,18 11,13 28,30 -53,146 -43,301 199,-71 334,-223 33,113 130,183 80,-56 127,-148 z M 404,821 q 29,20 6,48 -24,23 -53,4 -61,-40 -65,-105 1,-33 39,-31 36,3 35,37 8,32 38,47 z m 252,498 q 22,11 22,11 30,12 19,44 -12,30 -46,20 -118,-43 -163,-158 -7,-33 24,-45 31,-10 42,22 8,17 12,22 11,-9 29,-12 61,-10 71,54 3,22 -10,42 z" + style="color:#000000" /> + <g + transform="matrix(1,0,0,-1,0,2008)" + id="g16" + fill="#ffffff" + fill-rule="nonzero"> + <path + id="path4" + display="block" + d="m 490,1365 q 4,-9 13,-27 17,-42 17,-50 -2,-28 -29,-28 -20,0 -47,57 -4,8 -12,14 -27,28 8,47 32,19 50,-13 z" + style="color:#000000" /> + <path + id="path6" + display="block" + d="m 1080,994 q 70,-92 69,-205 -4,-33 -38,-33 -46,0 -36,34 3,55 -11,91 -23,57 -51,85 -15,30 18,44 32,15 49,-16 z" + style="color:#000000" /> + <path + id="path8" + display="block" + d="m 819,506 q -5,-36 2,-78 -60,12 -113,56 -32,17 -15,47 17,31 47,10 21,-11 38,-20 17,-9 41,-15 z" + style="color:#000000" /> + <path + id="path10" + display="block" + d="m 1756,1774 q -1,0 2,-54 3,-54 3,-118 1,-125 0,-258 -1,-133 -36,-267 -34,-128 -75,-218 -41,-90 -89,-157 -72,-108 -196,-183 -124,-75 -259,-98 4,23 3,47 -1,24 0,46 97,33 183,82 86,49 126,106 48,66 89,156 41,90 75,219 34,133 35,266 1,133 1,259 0,63 -3,117 -3,54 0,55 z" + style="color:#000000" /> + <path + id="path12" + display="block" + d="m 404,1187 q 29,-20 6,-48 -24,-23 -53,-4 -61,40 -65,105 1,33 39,31 36,-3 35,-37 8,-32 38,-47 z" + style="color:#000000" /> + <path + id="path14" + display="block" + d="m 656,689 q 22,-11 22,-11 30,-12 19,-44 -12,-30 -46,-20 -118,43 -163,158 -7,33 24,45 31,10 42,-22 8,-17 12,-22 11,9 29,12 61,10 71,-54 3,-22 -10,-42 z" + style="color:#000000" /> + </g> +</svg> diff --git a/client/public/images/pieces/Enpassant/wn.svg b/client/public/images/pieces/Enpassant/wn.svg new file mode 100644 index 00000000..2cff73d7 --- /dev/null +++ b/client/public/images/pieces/Enpassant/wn.svg @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + inkscape:version="1.0 (4035a4fb49, 2020-05-01)" + sodipodi:docname="wn.svg" + id="svg6" + viewBox="0 0 2048 2048" + version="1.1" + width="100%" + height="100%"> + <metadata + id="metadata12"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs10" /> + <sodipodi:namedview + inkscape:current-layer="svg6" + inkscape:window-maximized="0" + inkscape:window-y="20" + inkscape:window-x="0" + inkscape:cy="1024" + inkscape:cx="1024" + inkscape:zoom="0.35888672" + showgrid="false" + id="namedview8" + inkscape:window-height="1180" + inkscape:window-width="960" + inkscape:pageshadow="2" + inkscape:pageopacity="0" + guidetolerance="10" + gridtolerance="10" + objecttolerance="10" + borderopacity="1" + bordercolor="#666666" + pagecolor="#ffffff" /> + <path + id="path2" + fill="#ffffff" + display="block" + fill-rule="nonzero" + d="m 1756,234 q -1,0 2,54 3,54 3,118 1,125 0,258 -1,133 -36,267 -34,128 -75,218 -41,90 -89,157 -72,108 -196,183 -124,75 -259,98 9,-49 8,-96 -2,-36 -34,-36 -37,0 -33,36 3,132 -94,226 -76,-80 -82,-186 -2,-35 -36,-31 -32,1 -32,37 0,0 2,8 -41,-13 -86,-37 -29,-20 -47,10 -18,30 16,47 43,22 65,33 -86,88 -196,142 12,-139 76,-263 17,-26 -8,-46 -28,-22 -47,7 -7,10 -20,36 -21,-21 -28,-31 -7,-9 -24,-40 -17,-31 -26,-51 -9,-25 -8,-40 1,-15 3,-35 -9,-59 -40,-111 -31,-52 -81,-127 -47,-72 -72,-108 -25,-36 -38,-92 -9,-34 0,-82 9,-48 39,-76 46,-47 89,-43 14,0 37,11 23,11 37,42 26,57 43,57 25,0 27,-28 0,-6 -16,-50 -9,-20 -24,-42 -19,-26 -17,-22 16,-57 53,-20 11,11 25,41 14,30 44,81 35,59 75,96 40,37 71,60 18,13 44,30 26,17 70,35 35,14 77,34 42,20 76,53 46,45 71,111 13,37 10,91 -9,34 34,34 32,0 36,-33 0,-113 -64,-206 21,-64 11,-140 -9,-61 -42,-130 Q 1017,674 914,588 707,416 718,234 q 0,0 170,0 170,0 321,0 z" + style="color:#000000" /> + <path + id="path4" + fill="#000000" + display="block" + fill-rule="nonzero" + d="m 697,1319 q 13,-20 10,-42 -10,-64 -71,-54 -18,3 -29,12 -4,-5 -12,-22 -11,-32 -42,-22 -31,12 -24,45 45,115 163,158 34,10 45,-20 12,-32 -18,-44 -6,-3 -11,-5 -5,-2 -11,-6 z M 400,842 q -29,-18 -35,-48 1,-33 -31,-36 -35,-4 -36,30 4,66 59,105 26,21 48,-4 22,-27 -5,-47 z m 679,815 q 157,-10 291,-81 134,-71 228,-182 66,-78 124,-188 58,-110 94,-233 40,-143 50,-300 10,-157 11,-292 V 163 q 0,0 -155,0 -155,0 -404,0 H 647 q -9,0 -9,49 0,49 7,79 4,24 19,68 15,44 50,107 16,32 76,93 60,61 138,143 45,46 70,116 25,70 22,127 -37,-30 -81,-49 -212,-76 -307,-220 -7,-9 -45,-81 -20,-38 -34,-52 -19,-19 -55,-21 -56,-3 -87,54 -42,-12 -75,-10 -56,21 -81,45 -51,51 -66,102 -15,51 -16,110 0,84 104,222 122,159 130,242 0,36 7,81 6,31 25,60 13,20 17,27 4,7 17,23 9,12 15,18 6,6 15,18 11,13 28,30 -53,146 -43,301 199,-71 334,-223 33,113 130,183 80,-56 127,-148 z M 1756,234 q -1,0 2,54 3,54 3,118 1,125 0,258 -1,133 -36,267 -34,128 -75,218 -41,90 -89,157 -72,108 -196,183 -124,75 -259,98 9,-49 8,-96 -2,-36 -34,-36 -37,0 -33,36 3,132 -94,226 -76,-80 -82,-186 -2,-35 -36,-31 -32,1 -32,37 0,0 2,8 -41,-13 -86,-37 -29,-20 -47,10 -18,30 16,47 43,22 65,33 -86,88 -196,142 12,-139 76,-263 17,-26 -8,-46 -28,-22 -47,7 -7,10 -20,36 -21,-21 -28,-31 -7,-9 -24,-40 -17,-31 -26,-51 -9,-25 -8,-40 1,-15 3,-35 -9,-59 -40,-111 -31,-52 -81,-127 -47,-72 -72,-108 -25,-36 -38,-92 -9,-34 0,-82 9,-48 39,-76 46,-47 89,-43 14,0 37,11 23,11 37,42 26,57 43,57 25,0 27,-28 0,-6 -16,-50 -9,-20 -24,-42 -19,-26 -17,-22 16,-57 53,-20 11,11 25,41 14,30 44,81 35,59 75,96 40,37 71,60 18,13 44,30 26,17 70,35 35,14 77,34 42,20 76,53 46,45 71,111 13,37 10,91 -9,34 34,34 32,0 36,-33 0,-113 -64,-206 21,-64 11,-140 -9,-61 -42,-130 Q 1017,674 914,588 707,416 718,234 q 0,0 170,0 170,0 321,0 z" + style="color:#000000" /> +</svg> diff --git a/client/src/translations/rules/Monochrome/en.pug b/client/src/translations/rules/Monochrome/en.pug index 7a10d6d0..3fadcd51 100644 --- a/client/src/translations/rules/Monochrome/en.pug +++ b/client/src/translations/rules/Monochrome/en.pug @@ -15,13 +15,12 @@ p. figure.diagram-container .diagram.diag12 - | fen:3b4/3k4/8/8/8/8/3r4/3n4: + | fen:3b4/3q4/8/8/8/8/3r4/3n4: .diagram.diag22 | fen:3b4/3r4/8/8/8/8/8/3n4: figcaption Before and after Rxd7 p. - Kings have no royal status, and move like orthodox queens. Knights become knightriders: they can make any number of knight steps in a direction. There are no en-passant captures, and no castle. diff --git a/client/src/translations/rules/Monochrome/es.pug b/client/src/translations/rules/Monochrome/es.pug index 526f7bb5..3db3dde1 100644 --- a/client/src/translations/rules/Monochrome/es.pug +++ b/client/src/translations/rules/Monochrome/es.pug @@ -17,13 +17,12 @@ p. figure.diagram-container .diagram.diag12 - | fen:3b4/3k4/8/8/8/8/3r4/3n4: + | fen:3b4/3q4/8/8/8/8/3r4/3n4: .diagram.diag22 | fen:3b4/3r4/8/8/8/8/8/3n4: figcaption Antes y después de Rxd7 p. - Los reyes no tienen estatus real y se mueven como damas. Los caballos se convierten en caballeros: mueven un número arbitrario de casillas en una dirección dada. No hay capturas en passant ni enroque. diff --git a/client/src/translations/rules/Monochrome/fr.pug b/client/src/translations/rules/Monochrome/fr.pug index 091d0361..1d4a5bf4 100644 --- a/client/src/translations/rules/Monochrome/fr.pug +++ b/client/src/translations/rules/Monochrome/fr.pug @@ -17,13 +17,12 @@ p. figure.diagram-container .diagram.diag12 - | fen:3b4/3k4/8/8/8/8/3r4/3n4: + | fen:3b4/3q4/8/8/8/8/3r4/3n4: .diagram.diag22 | fen:3b4/3r4/8/8/8/8/8/3n4: figcaption Avant et après Rxd7 p. - Les rois n'ont pas de statut royal, et se déplacent comme des dames. Les cavaliers sont changés en chevaliers : ils se déplacent d'un nombre arbitraire de cases dans une direction donnée. Il n'y a ni prise en passant ni roque. diff --git a/client/src/variants/Enpassant.js b/client/src/variants/Enpassant.js index 53f5c4fb..4c6ca67d 100644 --- a/client/src/variants/Enpassant.js +++ b/client/src/variants/Enpassant.js @@ -13,6 +13,10 @@ export class EnpassantRules extends ChessRules { return true; } + getPpath(b) { + return (b[1] == V.KNIGHT ? "Enpassant/" : "") + b; + } + getEpSquare(moveOrSquare) { if (!moveOrSquare) return undefined; if (typeof moveOrSquare === "string") { diff --git a/client/src/variants/Monochrome.js b/client/src/variants/Monochrome.js index 919e7703..2d5a912f 100644 --- a/client/src/variants/Monochrome.js +++ b/client/src/variants/Monochrome.js @@ -37,6 +37,10 @@ export class MonochromeRules extends ChessRules { return true; } + getPpath(b) { + return (b[1] == V.KNIGHT ? "Enpassant/" : "") + b; + } + canIplay(side, [x, y]) { const xBounds = side == 'w' ? [4,7] : [0,3]; return this.turn == side && x >= xBounds[0] && x <= xBounds[1]; @@ -154,6 +158,8 @@ export class MonochromeRules extends ChessRules { static GenRandInitFen(randomness) { // Remove the en-passant + castle part of the FEN let fen = ChessRules.GenRandInitFen(randomness).slice(0, -6); + // Replace kings with queens + fen = fen.replace("k", "q").replace("K", "Q"); // Move pawns up: fen = fen.replace("pppppppp/8","8/pppppppp") .replace("8/PPPPPPPP","PPPPPPPP/8"); diff --git a/client/src/variants/Royalrace.js b/client/src/variants/Royalrace.js index 21a62c89..5232cc94 100644 --- a/client/src/variants/Royalrace.js +++ b/client/src/variants/Royalrace.js @@ -19,6 +19,10 @@ export class RoyalraceRules extends ChessRules { return { x: 11, y: 11 }; } + getPpath(b) { + return (b[1] == V.KNIGHT ? "Enpassant/" : "") + b; + } + static GenRandInitFen(randomness) { if (randomness == 0) return "92/92/92/92/92/92/92/92/92/qrbnp1PNBRQ/krbnp1PNBRK w 0"; -- 2.44.0