-# Improvements
-
-Find a way to generalize getCastleMoves and getPotentialPawnMoves,
-to limit code duplication.
-
# New variants
Landing pieces from empty board:
https://www.chessvariants.com/diffsetup.dir/unachess.html
Rugby http://www.echecspourtous.com/?page_id=7945
-Cannibal Chess with forced captures.
-
S-chess https://en.wikipedia.org/wiki/Seirawan_chess
Generator variant, called "Matrix" ?
"Shoot pieces": "Shoot pieces",
"Squares disappear": "Squares disappear",
"Standard rules": "Standard rules",
+ "Transform an essay": "Transform an essay",
"Unidentified pieces": "Unidentified pieces"
};
"Shoot pieces": "Tirar de las piezas",
"Squares disappear": "Las casillas desaparecen",
"Standard rules": "Reglas estandar",
+ "Transform an essay": "Transformar un ensayo",
"Unidentified pieces": "Piezas no identificadas"
};
"Shoot pieces": "Tirez sur les pièces",
"Squares disappear": "Les cases disparaissent",
"Standard rules": "Règles usuelles",
+ "Transform an essay": "Transformer un essai",
"Unidentified pieces": "Pièces non identifiées"
};
--- /dev/null
+p.boxed
+ | Only pawns. The first who crosses the board wins.
+
+p.
+ Pawns are given extra abilities: they can also move (but not capture)
+ like a king. The goal is to bring a pawn on the last rank.
+
+figure.diagram-container
+ .diagram
+ | fen:pppppppp/8/8/8/8/8/8/PPPPPPPP:
+ figcaption Initial position.
+
+h3 Source
+
+p
+ | I've read about this rule on
+ a(href="http://www.echecspourtous.com/?page_id=7945") this page
+ | on (in French). It seems interesting :)
--- /dev/null
+p.boxed
+ | Solo peones. El primer jugador que cruza el tablero gana.
+
+p.
+ Los peones ven aumentar sus poderes: también pueden moverse
+ (pero no capturar) como el rey. El objetivo es traer un peón al última fila.
+
+figure.diagram-container
+ .diagram
+ | fen:pppppppp/8/8/8/8/8/8/PPPPPPPPP:
+ figcaption Posición inicial.
+
+h3 Fuente
+
+p
+ | Descubrí esta regla en
+ a(href="http://www.echecspourtous.com/?page_id=7945") esta página
+ | (en francés). Se ve interesante :)
--- /dev/null
+p.boxed
+ | Seulement des pions. Le premier qui traverse l'échiquier gagne.
+
+p.
+ Les pions voient leurs pouvoirs augmenter : ils peuvent aussi se déplacer
+ (mais pas capturer) comme des rois. L'objectif est d'amener un pion sur la
+ dernière rangée.
+
+figure.diagram-container
+ .diagram
+ | fen:pppppppp/8/8/8/8/8/8/PPPPPPPP:
+ figcaption Position initiale.
+
+h3 Source
+
+p
+ | J'ai découvert cette règle sur
+ a(href="http://www.echecspourtous.com/?page_id=7945") cette page
+ | . Elle semble intéressante :)
--- /dev/null
+import { ChessRules } from "@/base_rules";
+import { ArrayFun } from "@/utils/array";
+
+export class RugbyRules extends ChessRules {
+ static get HasFlags() {
+ return false;
+ }
+
+ static get PawnSpecs() {
+ return Object.assign(
+ {},
+ ChessRules.PawnSpecs,
+ { promotions: [V.PAWN] }
+ );
+ }
+
+ getPotentialMovesFrom(sq) {
+ // There are only pawns:
+ return this.getPotentialPawnMoves(sq);
+ }
+
+ getPotentialPawnMoves(sq) {
+ const moves = super.getPotentialPawnMoves(sq);
+ // Add king movements, without capturing
+ const steps =
+ this.turn == 'w'
+ ? [ [-1,-1], [-1,1], [0,1], [0,-1], [1,-1], [1,0], [1,1] ]
+ : [ [1,-1], [1,1], [0,1], [0,-1], [-1,-1], [-1,0], [-1,1] ];
+ let addMoves = this.getSlideNJumpMoves(sq, steps, "oneStep");
+ return moves.concat(addMoves.filter(m => m.vanish.length == 1));
+ }
+
+ static GenRandInitFen() {
+ // Non-randomized variant. En-passant possible:
+ return "pppppppp/8/8/8/8/8/8/PPPPPPPP w 0 -";
+ }
+
+ filterValid(moves) {
+ return moves;
+ }
+
+ prePlay() {}
+ postPlay() {}
+ preUndo() {}
+ postUndo() {}
+
+ getCurrentScore() {
+ // Turn has changed:
+ const color = V.GetOppCol(this.turn);
+ const lastRank = (color == "w" ? 0 : V.size.x - 1);
+ if (ArrayFun.range(8).some(i => this.getColor(lastRank, i) == color))
+ // The opposing edge is reached!
+ return color == "w" ? "1-0" : "0-1";
+ if (this.atLeastOneMove()) return "*";
+ // Stalemate (will probably never happen)
+ return "1/2";
+ }
+};
('Marseille', 'Move twice'),
('Racingkings', 'Kings cross the 8x8 board'),
('Rifle', 'Shoot pieces'),
- ('Royalrace', 'Kings cross the 11x11 board'),
('Recycle', 'Reuse pieces'),
+ ('Royalrace', 'Kings cross the 11x11 board'),
+ ('Rugby', 'Score a try'),
('Shatranj', 'Ancient rules'),
('Suicide', 'Lose all pieces'),
('Suction', 'Attract opposite king'),