Add Wormhole1 + ranem Wormhole --> Wormhole2. Rename Selfabsorption (too long) into...
authorBenjamin Auder <benjamin.auder@somewhere>
Fri, 22 Jan 2021 00:56:05 +0000 (01:56 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Fri, 22 Jan 2021 00:56:05 +0000 (01:56 +0100)
36 files changed:
client/public/images/pieces/Wormhole/bc.svg [new symlink]
client/public/images/pieces/Wormhole/bm.svg [new symlink]
client/public/images/pieces/Wormhole/bw.svg [new symlink]
client/public/images/pieces/Wormhole/wc.svg [new symlink]
client/public/images/pieces/Wormhole/wm.svg [new symlink]
client/public/images/pieces/Wormhole/ww.svg [new symlink]
client/src/translations/en.js
client/src/translations/rules/Avalanche/en.pug
client/src/translations/rules/Avalanche/es.pug
client/src/translations/rules/Avalanche/fr.pug
client/src/translations/rules/Brotherhood/en.pug
client/src/translations/rules/Brotherhood/es.pug
client/src/translations/rules/Brotherhood/fr.pug
client/src/translations/rules/Hidden/en.pug
client/src/translations/rules/Hidden/es.pug
client/src/translations/rules/Hidden/fr.pug
client/src/translations/rules/Pawnsking/en.pug
client/src/translations/rules/Selfabsorb/en.pug [moved from client/src/translations/rules/Selfabsorption/en.pug with 100% similarity]
client/src/translations/rules/Selfabsorb/es.pug [moved from client/src/translations/rules/Selfabsorption/es.pug with 100% similarity]
client/src/translations/rules/Selfabsorb/fr.pug [moved from client/src/translations/rules/Selfabsorption/fr.pug with 100% similarity]
client/src/translations/rules/Wildebeest/en.pug
client/src/translations/rules/Wildebeest/es.pug
client/src/translations/rules/Wildebeest/fr.pug
client/src/translations/rules/Wormhole1/en.pug [moved from client/src/translations/rules/Wormhole/en.pug with 66% similarity]
client/src/translations/rules/Wormhole1/es.pug [moved from client/src/translations/rules/Wormhole/es.pug with 66% similarity]
client/src/translations/rules/Wormhole1/fr.pug [moved from client/src/translations/rules/Wormhole/fr.pug with 66% similarity]
client/src/translations/rules/Wormhole2/en.pug [new file with mode: 0644]
client/src/translations/rules/Wormhole2/es.pug [new file with mode: 0644]
client/src/translations/rules/Wormhole2/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/Selfabsorb.js [moved from client/src/variants/Selfabsorption.js with 97% similarity]
client/src/variants/Wormhole1.js [new file with mode: 0644]
client/src/variants/Wormhole2.js [moved from client/src/variants/Wormhole.js with 98% similarity]
server/db/populate.sql

diff --git a/client/public/images/pieces/Wormhole/bc.svg b/client/public/images/pieces/Wormhole/bc.svg
new file mode 120000 (symlink)
index 0000000..72fcf2c
--- /dev/null
@@ -0,0 +1 @@
+../Omega/bc.svg
\ No newline at end of file
diff --git a/client/public/images/pieces/Wormhole/bm.svg b/client/public/images/pieces/Wormhole/bm.svg
new file mode 120000 (symlink)
index 0000000..000f539
--- /dev/null
@@ -0,0 +1 @@
+../Maxima/bg.svg
\ No newline at end of file
diff --git a/client/public/images/pieces/Wormhole/bw.svg b/client/public/images/pieces/Wormhole/bw.svg
new file mode 120000 (symlink)
index 0000000..0c3782e
--- /dev/null
@@ -0,0 +1 @@
+../Omega/bw.svg
\ No newline at end of file
diff --git a/client/public/images/pieces/Wormhole/wc.svg b/client/public/images/pieces/Wormhole/wc.svg
new file mode 120000 (symlink)
index 0000000..c6fc3f5
--- /dev/null
@@ -0,0 +1 @@
+../Omega/wc.svg
\ No newline at end of file
diff --git a/client/public/images/pieces/Wormhole/wm.svg b/client/public/images/pieces/Wormhole/wm.svg
new file mode 120000 (symlink)
index 0000000..436f84d
--- /dev/null
@@ -0,0 +1 @@
+../Maxima/wg.svg
\ No newline at end of file
diff --git a/client/public/images/pieces/Wormhole/ww.svg b/client/public/images/pieces/Wormhole/ww.svg
new file mode 120000 (symlink)
index 0000000..d1ff626
--- /dev/null
@@ -0,0 +1 @@
+../Omega/ww.svg
\ No newline at end of file
index 176741d..7bf8e72 100644 (file)
@@ -304,7 +304,8 @@ export const translations = {
   "Shogi 5 x 5": "Shogi 5 x 5",
   "Shoot pieces": "Shoot pieces",
   "Spartan versus Persians": "Spartan versus Persians",
   "Shogi 5 x 5": "Shogi 5 x 5",
   "Shoot pieces": "Shoot pieces",
   "Spartan versus Persians": "Spartan versus Persians",
-  "Squares disappear": "Squares disappear",
+  "Squares disappear (v1)": "Squares disappear (v1)",
+  "Squares disappear (v2)": "Squares disappear (v2)",
   "Squat last rank (v1)": "Squat last rank (v1)",
   "Squat last rank (v2)": "Squat last rank (v2)",
   "Stacking Checkers variant": "Stacking Checkers variant",
   "Squat last rank (v1)": "Squat last rank (v1)",
   "Squat last rank (v2)": "Squat last rank (v2)",
   "Stacking Checkers variant": "Stacking Checkers variant",
index 8469d05..8321559 100644 (file)
@@ -32,3 +32,5 @@ p
   a(href="https://www.chessvariants.com/mvopponent.dir/avalanche.html")
     | Avalanche Chess
   | &nbsp;on chessvariants.com.
   a(href="https://www.chessvariants.com/mvopponent.dir/avalanche.html")
     | Avalanche Chess
   | &nbsp;on chessvariants.com.
+
+p Inventor: Ralph Betza (1977)
index 00ccc05..046449d 100644 (file)
@@ -35,3 +35,5 @@ p
   a(href="https://www.chessvariants.com/mvopponent.dir/avalanche.html")
     | Avalanche Chess
   | &nbsp;en chessvariants.com.
   a(href="https://www.chessvariants.com/mvopponent.dir/avalanche.html")
     | Avalanche Chess
   | &nbsp;en chessvariants.com.
+
+p Inventor: Ralph Betza (1977)
index 652df0f..e70fe79 100644 (file)
@@ -34,3 +34,5 @@ p
   a(href="https://www.chessvariants.com/mvopponent.dir/avalanche.html")
     | Avalanche Chess
   | &nbsp;sur chessvariants.com.
   a(href="https://www.chessvariants.com/mvopponent.dir/avalanche.html")
     | Avalanche Chess
   | &nbsp;sur chessvariants.com.
+
+p Inventeur : Ralph Betza (1977)
index ba4971b..7b96b7d 100644 (file)
@@ -14,3 +14,5 @@ p
   a(href="https://www.chessvariants.com/difftaking.dir/brotherhood.html")
     | Brotherhood Chess
   | &nbsp;on chessvariants.com.
   a(href="https://www.chessvariants.com/difftaking.dir/brotherhood.html")
     | Brotherhood Chess
   | &nbsp;on chessvariants.com.
+
+p Inventor: Gianluca Vecchi (1993)
index b04f4a1..752e736 100644 (file)
@@ -14,3 +14,5 @@ p
   a(href="https://www.chessvariants.com/difftaking.dir/brotherhood.html")
     | Brotherhood Chess
   | &nbsp;en chessvariants.com.
   a(href="https://www.chessvariants.com/difftaking.dir/brotherhood.html")
     | Brotherhood Chess
   | &nbsp;en chessvariants.com.
+
+p Inventor: Gianluca Vecchi (1993)
index 4565643..aa80f0a 100644 (file)
@@ -14,3 +14,5 @@ p
   a(href="https://www.chessvariants.com/difftaking.dir/brotherhood.html")
     | Brotherhood Chess
   | &nbsp;sur chessvariants.com.
   a(href="https://www.chessvariants.com/difftaking.dir/brotherhood.html")
     | Brotherhood Chess
   | &nbsp;sur chessvariants.com.
+
+p Inventeur : Gianluca Vecchi (1993)
index f1a24b3..e67441c 100644 (file)
@@ -33,4 +33,4 @@ p
   a(href="https://www.chessvariants.com/rules/strate-go-chess") Strate-Go chess
   | &nbsp;on chessvariants.com.
 
   a(href="https://www.chessvariants.com/rules/strate-go-chess") Strate-Go chess
   | &nbsp;on chessvariants.com.
 
-p Inventor: John Lewis (2005)
+p Inventor: John Kipling Lewis (2005)
index d11369e..703b31e 100644 (file)
@@ -37,4 +37,4 @@ p
     | variante Strate-Go
   | &nbsp;en chessvariants.com.
 
     | variante Strate-Go
   | &nbsp;en chessvariants.com.
 
-p Inventor: John Lewis (2005)
+p Inventor: John Kipling Lewis (2005)
index b822b72..28753b8 100644 (file)
@@ -37,4 +37,4 @@ p
     | variante Strate-Go
   | &nbsp;sur chessvariants.com.
 
     | variante Strate-Go
   | &nbsp;sur chessvariants.com.
 
-p Inventeur : John Lewis (2005)
+p Inventeur : John Kipling Lewis (2005)
index 1c23951..74df57d 100644 (file)
@@ -11,7 +11,7 @@ p
   a(href="/#/variants/Pawns") Pawns
   | &nbsp;Game. A king is added to its starting square. He moves as usual.
   | The first person to reach the other side with a pawn or king is the winner.
   a(href="/#/variants/Pawns") Pawns
   | &nbsp;Game. A king is added to its starting square. He moves as usual.
   | The first person to reach the other side with a pawn or king is the winner.
-  | You can also win if you capture the enemy king.
+  | You can also win by capturing the enemy king.
 
 h3 Source
 
 
 h3 Source
 
index aee7cbf..5f0b631 100644 (file)
@@ -35,4 +35,4 @@ p
     | Wildebeest page
   | &nbsp;on chessvariants.com.
 
     | Wildebeest page
   | &nbsp;on chessvariants.com.
 
-p Inventor: R. Wayne Schmittberger (1992)
+p Inventor: R. Wayne Schmittberger (1987)
index 9b4580d..a407e33 100644 (file)
@@ -34,4 +34,4 @@ p
     | Variante Wildebeest
   | &nbsp;en chessvariants.com.
 
     | Variante Wildebeest
   | &nbsp;en chessvariants.com.
 
-p Inventor: R. Wayne Schmittberger (1992)
+p Inventor: R. Wayne Schmittberger (1987)
index 63ccdab..fb04759 100644 (file)
@@ -36,4 +36,4 @@ p
     | variante Wildebeest
   | &nbsp;sur chessvariants.com.
 
     | variante Wildebeest
   | &nbsp;sur chessvariants.com.
 
-p Inventeur : R. Wayne Schmittberger (1992)
+p Inventeur : R. Wayne Schmittberger (1987)
@@ -21,7 +21,7 @@ p.
 
 figure.diagram-container
   .diagram
 
 figure.diagram-container
   .diagram
-    | fen:rbkxxxbn/ppxppppx/2qxxB2/4x2p/3P1x2/3n1x2/PPPxPPPP/RBxxxNKR b2,f2,b4,c5,g5,f6:
+    | fen:cwkxxxwn/ppxppppx/2mxxW2/4x2p/3P1x2/3n1x2/PPPxPPPP/CWxxxNKC b2,f2,b4,c5,g5,f6:
   figcaption Possible moves for the knight on d3.
 
 p.
   figcaption Possible moves for the knight on d3.
 
 p.
@@ -30,10 +30,24 @@ p.
 
 h3 Pieces movements
 
 
 h3 Pieces movements
 
+p Three new pieces replace usual sliders:
+
+figure.showPieces.text-center
+  img(src="/images/pieces/Wormhole/wc.png" style="width:60px")
+  img(src="/images/pieces/Wormhole/ww.png" style="width:60px")
+  img(src="/images/pieces/Wormhole/wm.png" style="width:60px")
+  figcaption Left to right: Champion, Wizard, Murray Lion.
+
 ul
 ul
-  li The rook moves one or two squares vertically or horizontally.
-  li The bishop moves one or two squares diagonally.
-  li The queen moves either like a rook or like a bishop.
+  li.
+    The champion moves two squares in any direction,
+    or one square orthogonally.
+  li.
+    The wizard moves like an extended knight: two squares in an orthogonal
+    direction, and then one diagonal step. Or, a single diagonal step.
+  li.
+    The Murray Lion can move two squares in any direction.
+    He can also capture (only) by one square like a king.
   li The other pieces move like in orthodox chess.
 p All pieces can jump over others when moving by two squares.
 
   li The other pieces move like in orthodox chess.
 p All pieces can jump over others when moving by two squares.
 
@@ -47,11 +61,9 @@ p
   a(href="https://www.chessvariants.com/32turn.dir/wormhole.html")
     | Wormhole chess
   | &nbsp;on chessvariants.com.
   a(href="https://www.chessvariants.com/32turn.dir/wormhole.html")
     | Wormhole chess
   | &nbsp;on chessvariants.com.
-  | I changed the pieces movements because I have a better feeling with the
-  | moves described earlier. It might evolve.
 
 p
 
 p
-  | Inventor (with other pieces' movements): Fergus Duniho (2000).
+  | Inventor: Fergus Duniho (2000).
   | Similar to 
   a(href="https://www.chessvariants.com/boardrules.dir/cheshir.html")
     | Cheshire Cat Chess
   | Similar to 
   a(href="https://www.chessvariants.com/boardrules.dir/cheshir.html")
     | Cheshire Cat Chess
@@ -22,7 +22,7 @@ p.
 
 figure.diagram-container
   .diagram
 
 figure.diagram-container
   .diagram
-    | fen:rbkxxxbn/ppxppppx/2qxxB2/4x2p/3P1x2/3n1x2/PPPxPPPP/RBxxxNKR b2,f2,b4,c5,g5,f6:
+    | fen:cwkxxxwn/ppxppppx/2mxxW2/4x2p/3P1x2/3n1x2/PPPxPPPP/CWxxxNKC b2,f2,b4,c5,g5,f6:
   figcaption Posibles movimientos para el caballo en d3.
 
 p.
   figcaption Posibles movimientos para el caballo en d3.
 
 p.
@@ -31,10 +31,24 @@ p.
 
 h3 ¿Como las piezas se mueven?
 
 
 h3 ¿Como las piezas se mueven?
 
+p Tres piezas nuevas reemplazan los "deslizadores" habituales:
+
+figure.showPieces.text-center
+  img(src="/images/pieces/Wormhole/wc.png" style="width:60px")
+  img(src="/images/pieces/Wormhole/ww.png" style="width:60px")
+  img(src="/images/pieces/Wormhole/wm.png" style="width:60px")
+  figcaption De izquierda a derecha: Campeón, Hechicero, León "Murray".
+
 ul
 ul
-  li La torre se mueve de una o dos casillas verticalmente u horizontalmente.
-  li El alfil se mueve de una o dos casillas en diagonal.
-  li La dama puede moverse como una torre o un alfil.
+  li.
+    El campeón se mueve dos casillas en cualquier dirección,
+    o bien una casilla ortogonalmente.
+  li.
+    El hechicero se mueve como un caballo reclinado: dos cuadrados en uno
+    dirección ortogonal, luego un paso diagonal. O solo un paso en diagonal.
+  li.
+    El león "Murray" se mueve dos cuadrados en cualquier dirección.
+    También puede (solo) capturar de una casilla como un rey.
   li Las otras piezas se mueven como en el ajedrez ortodoxo.
 p Todas las piezas pueden saltar sobre otras cuando se mueven dos espacios.
 
   li Las otras piezas se mueven como en el ajedrez ortodoxo.
 p Todas las piezas pueden saltar sobre otras cuando se mueven dos espacios.
 
@@ -48,11 +62,9 @@ h3 Fuente
   a(href="https://www.chessvariants.com/32turn.dir/wormhole.html")
     | variante Wormhole
   | &nbsp;en chessvariants.com.
   a(href="https://www.chessvariants.com/32turn.dir/wormhole.html")
     | variante Wormhole
   | &nbsp;en chessvariants.com.
-  | Cambié los movimientos de las piezas porque las descritas aquí
-  | Parece más adecuado. Esto podría evolucionar.
 
 p
 
 p
-  | Inventor (con otros movimientos de piezas): Fergus Duniho (2000).
+  | Inventor: Fergus Duniho (2000).
   | Similar a 
   a(href="https://www.chessvariants.com/boardrules.dir/cheshir.html")
     | Cheshire Cat Chess
   | Similar a 
   a(href="https://www.chessvariants.com/boardrules.dir/cheshir.html")
     | Cheshire Cat Chess
@@ -22,7 +22,7 @@ p.
 
 figure.diagram-container
   .diagram
 
 figure.diagram-container
   .diagram
-    | fen:rbkxxxbn/ppxppppx/2qxxB2/4x2p/3P1x2/3n1x2/PPPxPPPP/RBxxxNKR b2,f2,b4,c5,g5,f6:
+    | fen:cwkxxxwn/ppxppppx/2mxxW2/4x2p/3P1x2/3n1x2/PPPxPPPP/CWxxxNKC b2,f2,b4,c5,g5,f6:
   figcaption Coups possibles pour le cavalier en d3.
 
 p.
   figcaption Coups possibles pour le cavalier en d3.
 
 p.
@@ -31,10 +31,24 @@ p.
 
 h3 Déplacement des pièces
 
 
 h3 Déplacement des pièces
 
+p Trois nouvelles pièces remplacent les "glisseurs" usuels :
+
+figure.showPieces.text-center
+  img(src="/images/pieces/Wormhole/wc.png" style="width:60px")
+  img(src="/images/pieces/Wormhole/ww.png" style="width:60px")
+  img(src="/images/pieces/Wormhole/wm.png" style="width:60px")
+  figcaption De gauche à droite : Champion, Sorcier, Lion "Murray".
+
 ul
 ul
-  li La tour se déplace d'une ou deux cases verticalement ou horizontalement.
-  li Le fous se déplace d'une ou deux cases en diagonale.
-  li La dame peut se mouvoir comme une tour ou un fou.
+  li.
+    Le champion se déplace de deux cases dans n'importe quelle direction,
+    ou bien d'une case orthogonalement.
+  li.
+    Le sorcier se déplace comme un cavalier allongé : deux cases dans une
+    direction orthogonale, puis un pas diagonal. Ou, un seul pas diagonal.
+  li.
+    Le lion "Murray" se déplace de deux cases dans n'importe quelle direction.
+    Il peut aussi (seulement) capturer d'une case comme un roi.
   li Les autres pièces se déplacent comme aux échecs orthodoxes.
 p.
   Toutes les pièces peuvent sauter par dessus d'autres
   li Les autres pièces se déplacent comme aux échecs orthodoxes.
 p.
   Toutes les pièces peuvent sauter par dessus d'autres
@@ -51,11 +65,9 @@ p
   a(href="https://www.chessvariants.com/32turn.dir/wormhole.html")
     | variante Wormhole
   | &nbsp;sur chessvariants.com.
   a(href="https://www.chessvariants.com/32turn.dir/wormhole.html")
     | variante Wormhole
   | &nbsp;sur chessvariants.com.
-  | J'ai changé les déplacements des pièces car ceux décrits ici me
-  | paraissent mieux adaptés. Ceci pourrait évoluer.
 
 p
 
 p
-  | Inventeur (avec d'autres déplacements de pièces) : Fergus Duniho (2000).
+  | Inventeur : Fergus Duniho (2000).
   | Similaire à 
   a(href="https://www.chessvariants.com/boardrules.dir/cheshir.html")
     | Cheshire Cat Chess
   | Similaire à 
   a(href="https://www.chessvariants.com/boardrules.dir/cheshir.html")
     | Cheshire Cat Chess
diff --git a/client/src/translations/rules/Wormhole2/en.pug b/client/src/translations/rules/Wormhole2/en.pug
new file mode 100644 (file)
index 0000000..6e1370e
--- /dev/null
@@ -0,0 +1,14 @@
+p.boxed
+  | When a piece moves, the initial square disappears. It creates a 
+  a(href="https://en.wikipedia.org/wiki/Wormhole") "wormhole"
+  | .
+
+p
+  a(href="/#/variants/Wormhole1") Wormhole1
+  | &nbsp;variant, with more standard pieces' movements:
+ul
+  li The rook moves one or two squares vertically or horizontally.
+  li The bishop moves one or two squares diagonally.
+  li The queen moves either like a rook or like a bishop.
+  li The other pieces move like in orthodox chess.
+p All pieces can jump over others when moving by two squares.
diff --git a/client/src/translations/rules/Wormhole2/es.pug b/client/src/translations/rules/Wormhole2/es.pug
new file mode 100644 (file)
index 0000000..ba45800
--- /dev/null
@@ -0,0 +1,14 @@
+p.boxed
+  | Cuando una pieza se mueve, la casilla inicial desaparece. Esto crea un
+  a(href="https://es.wikipedia.org/wiki/Agujero_de_gusano") "agujero de gusano"
+  | .
+
+p
+  a(href="/#/variants/Wormhole1") Wormhole1
+  | &nbsp;variant, con movimientos de piezas más estándar:
+ul
+  li La torre se mueve de una o dos casillas verticalmente u horizontalmente.
+  li El alfil se mueve de una o dos casillas en diagonal.
+  li La dama puede moverse como una torre o un alfil.
+  li Las otras piezas se mueven como en el ajedrez ortodoxo.
+p Todas las piezas pueden saltar sobre otras cuando se mueven dos espacios.
diff --git a/client/src/translations/rules/Wormhole2/fr.pug b/client/src/translations/rules/Wormhole2/fr.pug
new file mode 100644 (file)
index 0000000..eb94134
--- /dev/null
@@ -0,0 +1,16 @@
+p.boxed
+  | Quand une pièce se déplace, la case initiale disparaît. Cela crée un
+  a(href="https://fr.wikipedia.org/wiki/Trou_de_ver") "trou de ver"
+  | .
+
+p
+  a(href="/#/variants/Wormhole1") Wormhole1
+  | &nbsp;variant, avec des mouvements de pièces plus standard :
+ul
+  li La tour se déplace d'une ou deux cases verticalement ou horizontalement.
+  li Le fou se déplace d'une ou deux cases en diagonale.
+  li La dame peut se mouvoir comme une tour ou un fou.
+  li Les autres pièces se déplacent comme aux échecs orthodoxes.
+p.
+  Toutes les pièces peuvent sauter par dessus d'autres
+  quand elles se déplacent de deux cases.
index edb525a..2c14ba6 100644 (file)
@@ -472,9 +472,10 @@ p.
     "Refusal",
     "Relayup",
     "Rollerball",
     "Refusal",
     "Relayup",
     "Rollerball",
-    "Selfabsorption",
+    "Selfabsorb",
     "Takenmake",
     "Takenmake",
-    "Wormhole"
+    "Wormhole1",
+    "Wormhole2"
   ]
 ul
   for v in varlist
   ]
 ul
   for v in varlist
index 28ba251..69756b1 100644 (file)
@@ -482,9 +482,10 @@ p.
     "Refusal",
     "Relayup",
     "Rollerball",
     "Refusal",
     "Relayup",
     "Rollerball",
-    "Selfabsorption",
+    "Selfabsorb",
     "Takenmake",
     "Takenmake",
-    "Wormhole"
+    "Wormhole1",
+    "Wormhole2"
   ]
 ul
   for v in varlist
   ]
 ul
   for v in varlist
index 9c881eb..91585e9 100644 (file)
@@ -480,9 +480,10 @@ p.
     "Refusal",
     "Relayup",
     "Rollerball",
     "Refusal",
     "Relayup",
     "Rollerball",
-    "Selfabsorption",
+    "Selfabsorb",
     "Takenmake",
     "Takenmake",
-    "Wormhole"
+    "Wormhole1",
+    "Wormhole2"
   ]
 ul
   for v in varlist
   ]
 ul
   for v in varlist
similarity index 97%
rename from client/src/variants/Selfabsorption.js
rename to client/src/variants/Selfabsorb.js
index 6f15d48..0a8a747 100644 (file)
@@ -1,7 +1,7 @@
 import { ChessRules } from "@/base_rules";
 import { AbsorptionRules } from "@/variants/Absorption";
 
 import { ChessRules } from "@/base_rules";
 import { AbsorptionRules } from "@/variants/Absorption";
 
-export class SelfabsorptionRules extends AbsorptionRules {
+export class SelfabsorbRules extends AbsorptionRules {
 
   canTake([x1, y1], [x2, y2]) {
     if (this.getColor(x1, y1) !== this.getColor(x2, y2)) return true;
 
   canTake([x1, y1], [x2, y2]) {
     if (this.getColor(x1, y1) !== this.getColor(x2, y2)) return true;
diff --git a/client/src/variants/Wormhole1.js b/client/src/variants/Wormhole1.js
new file mode 100644 (file)
index 0000000..8219d28
--- /dev/null
@@ -0,0 +1,192 @@
+import { ChessRules } from "@/base_rules";
+import { Wormhole2Rules } from "@/variants/Wormhole2";
+
+export class Wormhole1Rules extends Wormhole2Rules {
+
+  static get PawnSpecs() {
+    return Object.assign(
+      {},
+      ChessRules.PawnSpecs,
+      { promotions: [V.LION, V.CHAMPION, V.WIZARD, V.KNIGHT] }
+    );
+  }
+
+  static get LION() {
+    return 'm';
+  }
+  static get WIZARD() {
+    return 'w';
+  }
+  static get CHAMPION() {
+    return 'c';
+  }
+
+  static get PIECES() {
+    return [V.PAWN, V.CHAMPION, V.KNIGHT, V.WIZARD, V.LION, V.KING];
+  }
+
+  getPpath(b) {
+    if (b[0] == 'x') return "Wormhole/hole";
+    if ([V.LION, V.CHAMPION, V.WIZARD].includes(b[1]))
+      return "Wormhole/" + b;
+    return b;
+  }
+
+  static get steps() {
+    return {
+      w: [
+        [ [-2, 0], [-1, -1] ],
+        [ [-2, 0], [-1, 1] ],
+        [ [0, -2], [-1, -1] ],
+        [ [0, 2], [-1, 1] ],
+        [ [0, -2], [1, -1] ],
+        [ [0, 2], [1, 1] ],
+        [ [2, 0], [1, -1] ],
+        [ [2, 0], [1, 1] ]
+      ],
+      d: [
+        [-2, 0],
+        [0, -2],
+        [2, 0],
+        [0, 2]
+      ],
+      a: [
+        [2, 2],
+        [2, -2],
+        [-2, 2],
+        [-2, -2]
+      ],
+      f: [
+        [-1, -1],
+        [-1, 1],
+        [1, -1],
+        [1, 1]
+      ],
+      z: [
+        [-1, 0],
+        [1, 0],
+        [0, -1],
+        [0, 1]
+      ],
+      n: Wormhole2Rules.steps[V.KNIGHT],
+      k: Wormhole2Rules.steps[V.KING]
+    };
+  }
+
+  static GenRandInitFen(randomness) {
+    if (randomness == 0)
+      return "cnwmkwnc/pppppppp/8/8/8/8/PPPPPPPP/CNWMKWNC w 0";
+
+    // Mapping new --> standard:
+    const piecesMap = {
+      'r': 'c',
+      'n': 'n',
+      'b': 'w',
+      'q': 'm',
+      'k': 'k'
+    };
+
+    const baseFen = ChessRules.GenRandInitFen(randomness);
+    return (
+      baseFen.substr(0, 8).split('').map(p => piecesMap[p]).join('') +
+      baseFen.substr(8, 27) +
+      baseFen.substr(35, 43).split('')
+        .map(p => piecesMap[p]).join('').toUpperCase() +
+      " w 0"
+    );
+  }
+
+  getPotentialMovesFrom(sq) {
+    switch (this.getPiece(sq[0], sq[1])) {
+      case V.PAWN: return super.getPotentialPawnMoves(sq);
+      case V.CHAMPION: return this.getPotentialChampionMoves(sq);
+      case V.KNIGHT: return super.getPotentialKnightMoves(sq);
+      case V.WIZARD: return this.getPotentialWizardMoves(sq);
+      case V.LION: return this.getPotentialLionMoves(sq);
+      case V.KING: return super.getPotentialKingMoves(sq);
+    }
+    return [];
+  }
+
+  getJumpMoves([x, y], steps, onlyTake) {
+    let moves = [];
+    for (let step of steps) {
+      const sq = this.getSquareAfter([x,y], step);
+      if (sq &&
+        (
+          (!onlyTake && this.board[sq[0]][sq[1]] == V.EMPTY) ||
+          (this.board[sq[0]][sq[1]] != V.EMPTY && this.canTake([x, y], sq))
+        )
+      ) {
+        moves.push(this.getBasicMove([x, y], sq));
+      }
+    }
+    return moves;
+  }
+
+  getPotentialChampionMoves(sq) {
+    const steps = V.steps['d'].concat(V.steps['a']).concat(V.steps['z']);
+    return this.getJumpMoves(sq, steps);
+  }
+
+  getPotentialWizardMoves(sq) {
+    const steps = V.steps['w'].concat(V.steps['f']);
+    return this.getJumpMoves(sq, steps);
+  }
+
+  getPotentialLionMoves(sq) {
+    let steps = V.steps['d'].concat(V.steps['a']);
+    const moves1 = this.getJumpMoves(sq, steps);
+    steps = V.steps['f'].concat(V.steps['z']);
+    const moves2 = this.getJumpMoves(sq, steps, "onlyTake");
+    return moves1.concat(moves2);
+  }
+
+  isAttacked(sq, color) {
+    return (
+      super.isAttackedByPawn(sq, color) ||
+      this.isAttackedByChampion(sq, color) ||
+      super.isAttackedByKnight(sq, color) ||
+      this.isAttackedByWizard(sq, color) ||
+      this.isAttackedByLion(sq, color) ||
+      super.isAttackedByKing(sq, color)
+    );
+  }
+
+  isAttackedByWizard(sq, color) {
+    return (
+      this.isAttackedByJump(sq, color, V.WIZARD, V.steps['f']) ||
+      // NOTE: wizard attack is not symmetric in this variant:
+      // steps order need to be reversed.
+      this.isAttackedByJump(
+        sq,
+        color,
+        V.WIZARD,
+        V.steps['w'].map(s => s.reverse())
+      )
+    );
+  }
+
+  isAttackedByChampion(sq, color) {
+    const steps = V.steps['d'].concat(V.steps['a']).concat(V.steps['z']);
+    return this.isAttackedByJump(sq, color, V.CHAMPION, steps);
+  }
+
+  isAttackedByLion(sq, color) {
+    const steps = V.steps['d'].concat(V.steps['a'])
+                    .concat(V.steps['f']).concat(V.steps['z']);
+    return this.isAttackedByJump(sq, color, V.LION, steps);
+  }
+
+  static get VALUES() {
+    return {
+      p: 1,
+      n: 3,
+      c: 8,
+      m: 9,
+      w: 3,
+      k: 1000
+    };
+  }
+
+};
similarity index 98%
rename from client/src/variants/Wormhole.js
rename to client/src/variants/Wormhole2.js
index 05d8f2a..06b7fb6 100644 (file)
@@ -1,6 +1,6 @@
 import { ChessRules } from "@/base_rules";
 
 import { ChessRules } from "@/base_rules";
 
-export class WormholeRules extends ChessRules {
+export class Wormhole2Rules extends ChessRules {
 
   static get HasFlags() {
     return false;
 
   static get HasFlags() {
     return false;
@@ -150,7 +150,7 @@ export class WormholeRules extends ChessRules {
           this.canTake([x, y], sq)
         )
       ) {
           this.canTake([x, y], sq)
         )
       ) {
-          moves.push(this.getBasicMove([x, y], sq));
+        moves.push(this.getBasicMove([x, y], sq));
       }
     }
     return moves;
       }
     }
     return moves;
@@ -186,7 +186,7 @@ export class WormholeRules extends ChessRules {
         this.canTake([x, y], [sq[0], sq[1]])
       ) {
         const finalPieces = sq[0] == lastRank
         this.canTake([x, y], [sq[0], sq[1]])
       ) {
         const finalPieces = sq[0] == lastRank
-          ? [V.ROOK, V.KNIGHT, V.BISHOP, V.QUEEN]
+          ? V.PawnSpecs.promotions
           : [V.PAWN];
         for (let piece of finalPieces) {
           moves.push(
           : [V.PAWN];
         for (let piece of finalPieces) {
           moves.push(
index 142ef4a..5648379 100644 (file)
@@ -136,7 +136,7 @@ insert or ignore into Variants (name, description) values
   ('Rugby', 'Transform an essay'),
   ('Schess', 'Seirawan-Harper Chess'),
   ('Screen', 'Free initial setup'),
   ('Rugby', 'Transform an essay'),
   ('Schess', 'Seirawan-Harper Chess'),
   ('Screen', 'Free initial setup'),
-  ('Selfabsorption', 'Fusion pieces (v2)'),
+  ('Selfabsorb', 'Fusion pieces (v2)'),
   ('Shako', 'Non-conformism and utopia'),
   ('Shatranj', 'Ancient rules'),
   ('Shogi', 'Japanese Chess'),
   ('Shako', 'Non-conformism and utopia'),
   ('Shatranj', 'Ancient rules'),
   ('Shogi', 'Japanese Chess'),
@@ -159,7 +159,8 @@ insert or ignore into Variants (name, description) values
   ('Upsidedown', 'Board upside down'),
   ('Vchess', 'Pawns capture backward'),
   ('Wildebeest', 'Balanced sliders & leapers'),
   ('Upsidedown', 'Board upside down'),
   ('Vchess', 'Pawns capture backward'),
   ('Wildebeest', 'Balanced sliders & leapers'),
-  ('Wormhole', 'Squares disappear'),
+  ('Wormhole1', 'Squares disappear (v1)'),
+  ('Wormhole2', 'Squares disappear (v2)'),
   ('Xiangqi', 'Chinese Chess'),
   ('Yote', 'African Draughts'),
   ('Zen', 'Reverse captures');
   ('Xiangqi', 'Chinese Chess'),
   ('Yote', 'African Draughts'),
   ('Zen', 'Reverse captures');