From: Benjamin Auder Date: Tue, 8 Sep 2020 09:56:39 +0000 (+0200) Subject: Add Castle Chess X-Git-Url: https://git.auder.net/js/current/app_dev.php/css/%24%7BgetWhatsApp%28link%29%7D?a=commitdiff_plain;h=2bb4666e276e837add0958554a11b38f7f4d9357;p=vchess.git Add Castle Chess --- diff --git a/client/src/translations/en.js b/client/src/translations/en.js index f3682cc1..ae90c856 100644 --- a/client/src/translations/en.js +++ b/client/src/translations/en.js @@ -273,5 +273,6 @@ export const translations = { "Two royal pieces": "Two royal pieces", "Unidentified pieces": "Unidentified pieces", "Walk on a graph": "Walk on a graph", - "White move twice": "White move twice" + "White move twice": "White move twice", + "Win by castling long": "Win by castling long" }; diff --git a/client/src/translations/es.js b/client/src/translations/es.js index 0dafd6e9..16684723 100644 --- a/client/src/translations/es.js +++ b/client/src/translations/es.js @@ -273,5 +273,6 @@ export const translations = { "Two royal pieces": "Dos piezas reales", "Unidentified pieces": "Piezas no identificadas", "Walk on a graph": "Camino en un gráfico", - "White move twice": "Las blancas juegan dos veces" + "White move twice": "Las blancas juegan dos veces", + "Win by castling long": "Ganar jugando al enroque largo" }; diff --git a/client/src/translations/fr.js b/client/src/translations/fr.js index 3a38c66c..95fb5c44 100644 --- a/client/src/translations/fr.js +++ b/client/src/translations/fr.js @@ -273,5 +273,6 @@ export const translations = { "Two royal pieces": "Deux pièces royales", "Unidentified pieces": "Pièces non identifiées", "Walk on a graph": "Marche sur un graphe", - "White move twice": "Les blancs jouent deux fois" + "White move twice": "Les blancs jouent deux fois", + "Win by castling long": "Gagnez en jouant grand roque" }; diff --git a/client/src/translations/rules/Castle/en.pug b/client/src/translations/rules/Castle/en.pug new file mode 100644 index 00000000..e67dbb48 --- /dev/null +++ b/client/src/translations/rules/Castle/en.pug @@ -0,0 +1,25 @@ +p.boxed + | If Black castle long, they win. If they cannot, White wins. + +p. + Besides the usual game end conditions, White can win by preventing black + long castle. And, Black can win by castling long. + +p For example after 1.e4 e5 2.Bc4, Nc6?? loses immediatly: 3.Bxf7+ + +figure.diagram-container + .diagram + | fen:r1bqkbnr/pppp1Bpp/2n5/4p3/4P3/8/PPPP1PPP/RNBQK1NR: + figcaption After 1.e4 e5 2.Bc4 Nc6 3.Bxf7+ 1-0 + +h3 Source + +p + a(href="https://www.chessvariants.com/winning.dir/castle.html") + | Castle chess + |  on chessvariants.com. See also + a(href="http://cinquantesignes.blogspot.com/2020/09/castlechess.html") + | this post + |  giving some clarifications and advices. + +p Inventor: Éric Angelini (1996) diff --git a/client/src/translations/rules/Castle/es.pug b/client/src/translations/rules/Castle/es.pug new file mode 100644 index 00000000..69fb4d33 --- /dev/null +++ b/client/src/translations/rules/Castle/es.pug @@ -0,0 +1,27 @@ +p.boxed + | Si las negras enroquen por el lado largo, ganan. + | Si el enroque largo es imposible, las blancas ganan. + +p. + Además de las condiciones habituales al final del juego, las blancas pueden + ganar al evitar que las negras enroquen por el lado largo. Y las negras + pueden ganar jugando este enroque. + +p Por ejemplo, después de 1.e4 e5 2.Bc4, Nc6?? pierde inmediatamente: 3.Bxf7+ + +figure.diagram-container + .diagram + | fen:r1bqkbnr/pppp1Bpp/2n5/4p3/4P3/8/PPPP1PPP/RNBQK1NR: + figcaption Después de 1.e4 e5 2.Bc4 Nc6 3.Bxf7 + 1-0 + +h3 Fuente + +p + a(href="https://www.chessvariants.com/winning.dir/castle.html") + | Castle Chess + | & nbsp;en chessvariants.com. Ver también + a(href="http://cinquantesignes.blogspot.com/2020/09/castlechess.html") + | esta publicación + |  dando algunas aclaraciones y consejos. + +p Inventor: Éric Angelini (1996) diff --git a/client/src/translations/rules/Castle/fr.pug b/client/src/translations/rules/Castle/fr.pug new file mode 100644 index 00000000..3ed9352d --- /dev/null +++ b/client/src/translations/rules/Castle/fr.pug @@ -0,0 +1,27 @@ +p.boxed + | Si les noirs effectuent le grand roque, ils gagnent. + | Si le grand roque est impossible, les blancs gagnent. + +p. + En plus des conditions habituelles de fin de partie, les blancs peuvent + gagner en empêchant les noirs de roquer du côté long. Et, les noirs + peuvent gagner en jouant ce roque. + +p Par exemple après 1.e4 e5 2.Bc4, Nc6?? perd immédiatement : 3.Bxf7+ + +figure.diagram-container + .diagram + | fen:r1bqkbnr/pppp1Bpp/2n5/4p3/4P3/8/PPPP1PPP/RNBQK1NR: + figcaption Après 1.e4 e5 2.Bc4 Nc6 3.Bxf7+ 1-0 + +h3 Source + +p + a(href="https://www.chessvariants.com/winning.dir/castle.html") + | Castle chess + |  sur chessvariants.com. Voir aussi + a(href="http://cinquantesignes.blogspot.com/2020/09/castlechess.html") + | ce post + |  donnant quelques clarifications et conseils. + +p Inventeur : Éric Angelini (1996) diff --git a/client/src/translations/variants/en.pug b/client/src/translations/variants/en.pug index d22a4565..c4b93609 100644 --- a/client/src/translations/variants/en.pug +++ b/client/src/translations/variants/en.pug @@ -384,6 +384,7 @@ p. "Alice", "Ambiguous", "Bicolour", + "Castle", "Doublearmy", "Forward", "Freecapture", diff --git a/client/src/translations/variants/es.pug b/client/src/translations/variants/es.pug index 534c94d1..f78bc456 100644 --- a/client/src/translations/variants/es.pug +++ b/client/src/translations/variants/es.pug @@ -395,6 +395,7 @@ p. "Alice", "Ambiguous", "Bicolour", + "Castle", "Doublearmy", "Forward", "Freecapture", diff --git a/client/src/translations/variants/fr.pug b/client/src/translations/variants/fr.pug index e9621832..9ce1e438 100644 --- a/client/src/translations/variants/fr.pug +++ b/client/src/translations/variants/fr.pug @@ -394,6 +394,7 @@ p. "Alice", "Ambiguous", "Bicolour", + "Castle", "Doublearmy", "Forward", "Freecapture", diff --git a/client/src/variants/Castle.js b/client/src/variants/Castle.js new file mode 100644 index 00000000..af3710c9 --- /dev/null +++ b/client/src/variants/Castle.js @@ -0,0 +1,12 @@ +import { ChessRules } from "@/base_rules"; + +export class CastleRules extends ChessRules { + getCurrentScore() { + const baseScore = super.getCurrentScore(); + if (baseScore != '*') return baseScore; + if (this.getPiece(0,2) == V.KING && this.getPiece(0,3) == V.ROOK) + return "0-1"; + if (this.castleFlags['b'][0] >= 8) return "1-0"; + return '*'; + } +}; diff --git a/server/db/populate.sql b/server/db/populate.sql index 8de63af6..13d6594e 100644 --- a/server/db/populate.sql +++ b/server/db/populate.sql @@ -29,6 +29,7 @@ insert or ignore into Variants (name, description) values ('Bishopawns', 'Bishop versus pawns'), ('Cannibal', 'Capture powers'), ('Capture', 'Mandatory captures'), + ('Castle', 'Win by castling long'), ('Checkered1', 'Shared pieces (v1)'), ('Checkered2', 'Shared pieces (v2)'), ('Checkless', 'No-check mode'),