V.OnBoard(rx, ry) &&
this.board[rx][ry] != V.EMPTY &&
this.getPiece(rx, ry) == piece &&
- this.getColor(rx, ry) == color &&
- this.canTake([rx, ry], [x, y]) //for Paco-Sako (TODO: necessary?)
+ this.getColor(rx, ry) == color
) {
return true;
}
"Two kings": "Two kings",
"Two royal pieces": "Two royal pieces",
"Unidentified pieces": "Unidentified pieces",
+ "Upgrade pieces": "Upgrade pieces",
"Walk on a graph": "Walk on a graph",
"White move twice": "White move twice",
"Win by castling long": "Win by castling long",
"Two kings": "Dos reyes",
"Two royal pieces": "Dos piezas reales",
"Unidentified pieces": "Piezas no identificadas",
+ "Upgrade pieces": "Aumentar piezas",
"Walk on a graph": "Camino en un gráfico",
"White move twice": "Las blancas juegan dos veces",
"Win by castling long": "Ganar jugando al enroque largo",
"Two kings": "Deux rois",
"Two royal pieces": "Deux pièces royales",
"Unidentified pieces": "Pièces non identifiées",
+ "Upgrade pieces": "Augmenter les pièces",
"Walk on a graph": "Marche sur un graphe",
"White move twice": "Les blancs jouent deux fois",
"Win by castling long": "Gagnez en jouant grand roque",
--- /dev/null
+p.boxed
+ | Pieces inherit the movement of friendly pieces observing them.
+
+p
+ | This variant is based on
+ a(href="https://www.chessvariants.com/rules/relay-chess") Relay Chess
+ | from chessvariants.com by Johnny Luken (2012).
+
+p.
+ As in Relay Chess, there is no castle or en passant captures, and pawns
+ can only advance one square forward (by themselves).
+
+p However, I made two substantial changes:
+ul
+ li.
+ Being relayed by a friendly piece adds moving options, without canceling
+ the base movements of a piece. Thus the relay is an "upgrade", explaining
+ the chosen name "Relayup".
+ li.
+ Pawns relayed by any friendly piece (except pawns) gain the ability to
+ move and capture like it, but by one step only.
+
+figure.diagram-container
+ .diagram
+ | fen:rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR c3,d4,d3,e3,f4,f3,g3:
+ figcaption.
+ Movements of the e2 pawn, relayed by knight and queen (+ king and bishop).
+
+p.
+ Finally, since stalemate counts as a win and (I believe) no fully blocked
+ positions can be reached, the goal is now to capture the enemy king.
+ You can theoretically go or remain into check.
--- /dev/null
+p.boxed
+ | Las piezas heredan los movimientos de las piezas amigas observándolas.
+
+p
+ | Esta variante se basa en
+ a(href="https://www.chessvariants.com/rules/relay-chess") Relay Chess
+ | de chessvariants.com por Johnny Luken (2012).
+
+p.
+ Como en Relay Chess, no hay enroque ni captura en passant, y los peones
+ solo pueden avanzar una casilla (por sí mismos).
+
+p Sin embargo, hice dos cambios sustanciales:
+ul
+ li.
+ Ser transmitido por una parte amiga agrega capacidades de movimiento, sin
+ cancelar los movimientos básicos de una pieza. Entonces el relé
+ corresponde a un "upgrade", explicando el nombre elegido "Relayup".
+ li.
+ Peones transmitidos por cualquier pieza amiga (excepto los peones)
+ ganar la oportunidad de moverse y capturar como ellos, pero
+ con solo un paso.
+
+figure.diagram-container
+ .diagram
+ | fen:rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR c3,d4,d3,e3,f4,f3,g3:
+ figcaption.
+ Movimientos del peón e2, transmitidos por caballo y dama (+ rey y alfil).
+
+p.
+ Finalmente, dado que el empate cuenta como una victoria y (creo)
+ no hay configuraciones completamente bloqueadas, el objetivo es capturar
+ el rey. Tiene derecho a ir o permanecer en jaque.
--- /dev/null
+p.boxed
+ | Les pièces héritent des mouvements des pièces amies les observant.
+
+p
+ | Cette variante est basée sur
+ a(href="https://www.chessvariants.com/rules/relay-chess") Relay Chess
+ | de chessvariants.com par Johnny Luken (2012).
+
+p.
+ Comme dans Relay Chess, il n'y a ni roque ni prise en passant, et les pions
+ ne peuvent avancer que d'une case vers l'avant (par eux-mêmes).
+
+p Cependant, j'ai effectué deux changements substantiels :
+ul
+ li.
+ Être relayé par une pièce amie ajoute des capacités de déplacement, sans
+ annuler les mouvements de base d'une pièce. Ainsi le relai correspond à
+ un "upgrade", expliquant le nom choisi "Relayup".
+ li.
+ Les pions relayés par n'importe quelle pièce amie (sauf les pions)
+ gagnent la possibilité de se déplacer et capturer comme elles, mais
+ d'un pas seulement.
+
+figure.diagram-container
+ .diagram
+ | fen:rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR c3,d4,d3,e3,f4,f3,g3:
+ figcaption.
+ Déplacements du pion e2, relayé par cavalier et dame (+ roi et fou).
+
+p.
+ Enfin, puisque le pat compte comme une victoire et que (je crois) il
+ n'existe pas de configurations complètement bloquées, le but est de capturer
+ le roi. Vous avez le droit d'aller ou de rester en échec.
"Otage",
"Pacosako",
"Parachute",
+ "Relayup",
"Screen",
"Takenmake",
"Titan",
"Otage",
"Pacosako",
"Parachute",
+ "Relayup",
"Screen",
"Takenmake",
"Titan",
"Otage",
"Pacosako",
"Parachute",
+ "Relayup",
"Screen",
"Takenmake",
"Titan",
return res;
}
+ isAttackedBySlideNJump([x, y], color, piece, steps, oneStep) {
+ for (let step of steps) {
+ let rx = x + step[0],
+ ry = y + step[1];
+ while (V.OnBoard(rx, ry) && this.board[rx][ry] == V.EMPTY && !oneStep) {
+ rx += step[0];
+ ry += step[1];
+ }
+ if (
+ V.OnBoard(rx, ry) &&
+ this.board[rx][ry] != V.EMPTY &&
+ this.getPiece(rx, ry) == piece &&
+ this.getColor(rx, ry) == color &&
+ this.canTake([rx, ry], [x, y]) //TODO: necessary line?
+ //If not, generic method is OK
+ ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
// Do not consider checks, except to forbid castling
getCheckSquares() {
return [];
import { ChessRules } from "@/base_rules";
-// Pawns relayed by one square at a time (but with relaying pioece movements)
+// Pawns relayed by one square at a time (but with relaying piece movements)
// diff from https://www.chessvariants.com/rules/relay-chess ==> new name
export class RelayupRules extends ChessRules {
getPotentialMovesFrom([x, y]) {
let moves = super.getPotentialMovesFrom([x, y]);
+ // Expand potential moves if guarded by friendly pieces.
+ // NOTE: pawns cannot be promoted through a relaying move
+ const piece = this.getPiece(x,y);
+ const color = this.turn;
+ const lastRank = (color == 'w' ? 0 : 7);
+ const sq = [x, y];
+ const oneStep = (piece == V.PAWN);
+ let guardedBy = {};
+ if (piece != V.ROOK && super.isAttackedByRook(sq, color))
+ guardedBy[V.ROOK] = true;
+ if (piece != V.KNIGHT && super.isAttackedByKnight(sq, color))
+ guardedBy[V.KNIGHT] = true;
+ if (piece != V.BISHOP && super.isAttackedByBishop(sq, color))
+ guardedBy[V.BISHOP] = true;
+ if (piece != V.QUEEN && super.isAttackedByQueen(sq, color))
+ guardedBy[V.QUEEN] = true;
+ if (piece != V.KING && super.isAttackedByKing(sq, color))
+ guardedBy[V.KING] = true;
+ Object.keys(guardedBy).forEach(pg => {
+ let steps = null;
+ if ([V.ROOK, V.KNIGHT, V.BISHOP].includes(pg)) steps = V.steps[pg];
+ else steps = V.steps[V.ROOK].concat(V.steps[V.BISHOP]);
+ const extraMoves =
+ super.getSlideNJumpMoves(
+ sq, steps, oneStep || [V.KNIGHT, V.KING].includes(pg))
+ .filter(m => {
+ return (
+ (piece != V.PAWN || m.end.x != lastRank) &&
+ (moves.every(mv => mv.end.x != m.end.x || mv.end.y != m.end.y))
+ );
+ });
+ moves = moves.concat(extraMoves);
+ });
+ return moves;
+ }
- // Expand possible moves if guarded by friendly pieces:
- // --> Pawns cannot be promoted through a relaying move (thus 8th rank forbidden)
- // TODO
-
+ filterValid(moves) {
return moves;
}
+ getCheckSquares() {
+ return [];
+ }
+
+ postPlay(move) {
+ super.postPlay(move);
+ if (move.vanish.length == 2 && move.vanish[1].p == V.KING)
+ this.kingPos[move.vanish[1].c] = [-1, -1];
+ }
+
+ postUndo(move) {
+ super.postUndo(move);
+ if (move.vanish.length == 2 && move.vanish[1].p == V.KING) {
+ const v = move.vanish[1];
+ this.kingPos[v.c] = [v.x, v.y];
+ }
+ }
+
+ getCurrentScore() {
+ const c = this.turn;
+ if (this.kingPos[c][0] < 0) return (c == 'w' ? "0-1" : "1-0");
+ // It seems that there is always a possible move (TODO: check this)
+ return "*";
+ }
getNotation(move) {
// Translate final and initial square
('Queenpawns', 'Queen versus pawns'),
('Racingkings', 'Kings cross the 8x8 board'),
('Rampage', 'Move under cover'),
+ ('Relayup', 'Upgrade pieces'),
('Rifle', 'Shoot pieces'),
('Recycle', 'Reuse pieces'),
('Rococo', 'Capture on the edge'),