Add Castle Chess
authorBenjamin Auder <benjamin.auder@somewhere>
Tue, 8 Sep 2020 09:56:39 +0000 (11:56 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Tue, 8 Sep 2020 09:56:39 +0000 (11:56 +0200)
client/src/translations/en.js
client/src/translations/es.js
client/src/translations/fr.js
client/src/translations/rules/Castle/en.pug [new file with mode: 0644]
client/src/translations/rules/Castle/es.pug [new file with mode: 0644]
client/src/translations/rules/Castle/fr.pug [new file with mode: 0644]
client/src/translations/variants/en.pug
client/src/translations/variants/es.pug
client/src/translations/variants/fr.pug
client/src/variants/Castle.js [new file with mode: 0644]
server/db/populate.sql

index f3682cc..ae90c85 100644 (file)
@@ -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",
   "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"
 };
 };
index 0dafd6e..1668472 100644 (file)
@@ -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",
   "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"
 };
 };
index 3a38c66..95fb5c4 100644 (file)
@@ -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",
   "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 (file)
index 0000000..e67dbb4
--- /dev/null
@@ -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
+  | &nbsp;on chessvariants.com. See also 
+  a(href="http://cinquantesignes.blogspot.com/2020/09/castlechess.html")
+    | this post
+  | &nbsp;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 (file)
index 0000000..69fb4d3
--- /dev/null
@@ -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
+  | &nbsp;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 (file)
index 0000000..3ed9352
--- /dev/null
@@ -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
+  | &nbsp;sur chessvariants.com. Voir aussi 
+  a(href="http://cinquantesignes.blogspot.com/2020/09/castlechess.html")
+    | ce post
+  | &nbsp;donnant quelques clarifications et conseils.
+
+p Inventeur : Éric Angelini (1996)
index d22a456..c4b9360 100644 (file)
@@ -384,6 +384,7 @@ p.
     "Alice",
     "Ambiguous",
     "Bicolour",
     "Alice",
     "Ambiguous",
     "Bicolour",
+    "Castle",
     "Doublearmy",
     "Forward",
     "Freecapture",
     "Doublearmy",
     "Forward",
     "Freecapture",
index 534c94d..f78bc45 100644 (file)
@@ -395,6 +395,7 @@ p.
     "Alice",
     "Ambiguous",
     "Bicolour",
     "Alice",
     "Ambiguous",
     "Bicolour",
+    "Castle",
     "Doublearmy",
     "Forward",
     "Freecapture",
     "Doublearmy",
     "Forward",
     "Freecapture",
index e962183..9ce1e43 100644 (file)
@@ -394,6 +394,7 @@ p.
     "Alice",
     "Ambiguous",
     "Bicolour",
     "Alice",
     "Ambiguous",
     "Bicolour",
+    "Castle",
     "Doublearmy",
     "Forward",
     "Freecapture",
     "Doublearmy",
     "Forward",
     "Freecapture",
diff --git a/client/src/variants/Castle.js b/client/src/variants/Castle.js
new file mode 100644 (file)
index 0000000..af3710c
--- /dev/null
@@ -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 '*';
+  }
+};
index 8de63af..13d6594 100644 (file)
@@ -29,6 +29,7 @@ insert or ignore into Variants (name, description) values
   ('Bishopawns', 'Bishop versus pawns'),
   ('Cannibal', 'Capture powers'),
   ('Capture', 'Mandatory captures'),
   ('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'),
   ('Checkered1', 'Shared pieces (v1)'),
   ('Checkered2', 'Shared pieces (v2)'),
   ('Checkless', 'No-check mode'),