From: Benjamin Auder Date: Tue, 25 Feb 2020 13:57:02 +0000 (+0100) Subject: Write Royalrace rules X-Git-Url: https://git.auder.net/?p=vchess.git;a=commitdiff_plain;h=f446ee645526d617c8369add83de66888d2db6ce Write Royalrace rules --- diff --git a/client/src/components/ComputerGame.vue b/client/src/components/ComputerGame.vue index c05eea05..1181971b 100644 --- a/client/src/components/ComputerGame.vue +++ b/client/src/components/ComputerGame.vue @@ -72,13 +72,14 @@ export default { game = { vname: this.gameInfo.vname, fenStart: V.GenRandInitFen(), - mycolor: Math.random() < 0.5 ? "w" : "b", moves: [] }; game.fen = game.fenStart; if (this.gameInfo.mode == "versus") CompgameStorage.add(game); } + if (this.gameInfo.mode == "versus" && !game.mycolor) + game.mycolor = Math.random() < 0.5 ? "w" : "b"; this.compWorker.postMessage(["init", game.fen]); this.vr = new V(game.fen); game.players = [{ name: "Myself" }, { name: "Computer" }]; diff --git a/client/src/translations/rules/Royalrace/en.pug b/client/src/translations/rules/Royalrace/en.pug index e9c796ad..2a1bd23e 100644 --- a/client/src/translations/rules/Royalrace/en.pug +++ b/client/src/translations/rules/Royalrace/en.pug @@ -2,7 +2,29 @@ p.boxed | Bring your king to the other side of the board. | Giving check is not allowed. -p TODO +p. + The board is of size 11 by 11, and to win your king must arrive on the 11th rank. + He can never be in check (thus there is no checkmate). + Stalemate would be a draw, but it seldom occur in this variant. + +p. + The basic strategy is to erect barriers on the way of the opponent king, + with rooks and queen for example, while your king advance next to it. + +figure.diagram-container + .diagram + | fen:9r1/1K9/4R6/10k/Q10/2B1RNb2p1/4Pn5/6Nq3/6p1r1n/P10/2B5b2: + figcaption White can win by 1.Re8 Rxe8 2.Rxe8 and 3.Ka8 or 3.Kc8. + +h3 Adapted pieces movement + +ul + li. + The knights are turned into knightriders: + they can make multi knight steps in the same direction. + li. + The pawns can move as rooks. + They still capture one square diagonally, and can also do it backward. h3 Source diff --git a/client/src/translations/rules/Royalrace/es.pug b/client/src/translations/rules/Royalrace/es.pug index 4f56997b..b69f3ec4 100644 --- a/client/src/translations/rules/Royalrace/es.pug +++ b/client/src/translations/rules/Royalrace/es.pug @@ -1 +1,36 @@ -p TODO +p.boxed + | Lleva a tu rey al otro lado del tablero. + | Las jaques no están permitidas. + +p. + El tablero de ajedrez mide 11 por 11, y para ganar tu rey debes alcanzar + en la 11ma fila. + Él nunca puede estar en jaque (por lo que no hay jaque mate). + El empate significaría tablas, pero rara vez ocurre en esta variante. + +p. + La estrategia básica es erigir barreras en el camino del rey contrario, + con torres y la dama, por ejemplo, mientras tu rey avanza al lado. + +figure.diagram-container + .diagram + | fen:9r1/1K9/4R6/10k/Q10/2B1RNb2p1/4Pn5/6Nq3/6p1r1n/P10/2B5b2: + figcaption Las blancas pueden ganar por 1.Re8 Rxe8 2.Rxe8 y 3.Ka8 o 3.Kc8. + +h3 Movimientos de piezas adaptadas + +ul + li. + Los caballos se convierten en caballeros: + pueden hacer varios saltos de caballo en la misma dirección. + li. + Los peones se mueven como torres. + Siempre capturan desde un cuadrado diagonal, + y también puede hacerlo al revés. + +h3 Fuente + +p + | Fuertemente inspirado por la variante Racing Kings, jugable entre otros + a(href="https://lichess.org/variant/racingKings") en lichess + | . diff --git a/client/src/translations/rules/Royalrace/fr.pug b/client/src/translations/rules/Royalrace/fr.pug index 4f56997b..9de7ae0e 100644 --- a/client/src/translations/rules/Royalrace/fr.pug +++ b/client/src/translations/rules/Royalrace/fr.pug @@ -1 +1,36 @@ -p TODO +p.boxed + | Amenez votre roi de l'autre côté de l'échiquier. + | Les échecs ne sont pas autorisés. + +p. + L'échiquier est de taille 11 par 11, et pour gagner votre roi doit parvenir + sur la 11eme rangée. + Il ne peut jamais être en échec (il n'y a donc pas de mat). + Le pat signifierait match nul, mais il arrive très rarement dans cette variante. + +p. + La stratégie de base consiste à ériger des barrières sur le chemin du roi adverse, + avec des tours et la dame par exemple, tandis que votre roi avance à côté. + +figure.diagram-container + .diagram + | fen:9r1/1K9/4R6/10k/Q10/2B1RNb2p1/4Pn5/6Nq3/6p1r1n/P10/2B5b2: + figcaption Les blancs peuvent gagner par 1.Re8 Rxe8 2.Rxe8 et 3.Ka8 ou 3.Kc8. + +h3 Déplacements de pièces adaptés + +ul + li. + Les cavaliers deviennent des chevaliers : + ils peuvent effectuer plusieurs sauts de cavalier dans une même direction. + li. + Les pions se déplacent comme des tours. + Ils capturent toujours d'une case en diagonale, + et peuvent aussi le faire en arrière. + +h3 Source + +p + | Fortement inspiré par la variante Racing Kings jouable entre autres + a(href="https://lichess.org/variant/racingKings") sur lichess + | . diff --git a/client/src/variants/Royalrace.js b/client/src/variants/Royalrace.js index 1ae531d5..e3ed224b 100644 --- a/client/src/variants/Royalrace.js +++ b/client/src/variants/Royalrace.js @@ -84,9 +84,11 @@ export const VariantRules = class RoyalraceRules extends ChessRules { "11/11/11/11/11/11/11/11/11/" + whiteFen.substr(5).split("").reverse().join("") + "1" + - blackFen.substr(5).split("").reverse().join("") + + blackFen.substr(5).split("").join("") + "/" + - whiteFen.substr(0,5) + "1" + blackFen.substr(0,5) + + whiteFen.substr(0,5) + + "1" + + blackFen.substr(0,5).split("").reverse().join("") + " w 0" ); } @@ -99,15 +101,16 @@ export const VariantRules = class RoyalraceRules extends ChessRules { return m.vanish.length == 1; }); - // Captures - const shiftX = -1; - for (let shiftY of [-1, 1]) { - if ( - V.OnBoard(x + shiftX, y + shiftY) && - this.board[x + shiftX][y + shiftY] != V.EMPTY && - this.canTake([x, y], [x + shiftX, y + shiftY]) - ) { - moves.push(this.getBasicMove([x, y], [x + shiftX, y + shiftY])); + // Captures (in both directions) + for (let shiftX of [-1, 1]) { + for (let shiftY of [-1, 1]) { + if ( + V.OnBoard(x + shiftX, y + shiftY) && + this.board[x + shiftX][y + shiftY] != V.EMPTY && + this.canTake([x, y], [x + shiftX, y + shiftY]) + ) { + moves.push(this.getBasicMove([x, y], [x + shiftX, y + shiftY])); + } } }