From 306dab5f2087a35669a114587c0415b31145665b Mon Sep 17 00:00:00 2001 From: Benjamin Auder 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 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + 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 @@ + + + + + + image/svg+xml + + + + + + + + + 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