From: Benjamin Auder Date: Fri, 1 Jan 2021 18:20:56 +0000 (+0100) Subject: Advance on Janggi translation + fix initial setup moves X-Git-Url: https://git.auder.net/?p=vchess.git;a=commitdiff_plain;h=45d52e8a6a0faa784a545eae7b1ea551c3e8061b Advance on Janggi translation + fix initial setup moves --- diff --git a/client/src/translations/rules/Janggi/en.pug b/client/src/translations/rules/Janggi/en.pug index 5c3d09c6..99c2f081 100644 --- a/client/src/translations/rules/Janggi/en.pug +++ b/client/src/translations/rules/Janggi/en.pug @@ -1,6 +1,103 @@ p.boxed - | TODO: Korean Chess + | Korean Chess, with different pieces behaving + | differently than orthodox chess. -p https://www.pychess.org/variant/janggi +p. + Pieces stand on intersections rather than squares: this is purely aesthetic, + and doesn't affect movements' descriptions. -p https://fr.wikipedia.org/wiki/Janggi +p + | Initial position is almost the same as in + a(href="/#/variants/Xiangqi") Xiangqi + | , with the exception of the kings in the middle of the palaces. + | Also, at the first move you may choose to swap knight and elephant + | positions: either both, or on one side only. + +p More precisely, at first move: +ul + li White can keep the initial setup by playing a pass move, or + li + | exchange knight / elephant positions on either side, and then + ul + li pass (by bringing your king onto the enemy king), or + li exchange positions on the other side too. +p Then it's Black turn to do the same, and the game starts. + +figure.diagram-container + .diagram.diag12 + | fen:rnea1aenr/4k4/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/4K4/RNEA1AENR: + .diagram.diag22 + | fen:rnea1aner/4k4/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/4K4/RENA1AENR: + figcaption Left: initial position. Right: after rearranging. + +h3 Pieces movements + +ul + li. + The King moves along any line of the palace, but cannot leave the palace. + The same goes for his Advisors. + Contrary to Xiangqi, kings can face each other on a file, but if this + situation lasts two half moves, the game is a draw: "bikjang". + li. + Rooks and knights move like in orthodox chess, but the knight does not + jump: it goes one square orthogonally first, then one diagonally. + If the first is occupied, the move is impossible. + li. + Elephants move like knights, but one square diagonally further: they + land at the opposite corner of a 2 x 3 rectangle, and intermediate squares + must be free. + li. + The Cannons move like rooks but need a piece on their way to jump first. + That is to say, on an empty rank or file cannons cannot move at all. + They can only reach the squares behind the first obstacle. + Moreover, a cannon cannot jump over or capture another cannon. + li. + Pawns behave like promoted pawns from Xiangqi: they move one square + forward or lateraly. + +p. + Additionally, cannons, rooks and pawns may move along the palace diagonals. + Also, it's possible to pass instead of playing a move. + Two consecutive passes result in a draw. + +figure.diagram-container + .diagram.diag12 + | fen:4r4/9/4n4/9/9/2r1Cr2c/9/4C4/9/9 a5,b5,e9,e10,g5,h5: + .diagram.diag22 + | fen:9/9/2r6/9/9/4EP3/3p5/5p3/9/9 b7,b3,c2,c8,g8: + figcaption Left: Cannon moves. Right: Elephant moves. + +h3 Pieces valuation + +p These are the official values: + +table + tr + th Piece + th Value + tr + td Chariot + td 13 + tr + td Cannon + td 7 + tr + td Horse + td 5 + tr + td Elephant + td 3 + tr + td Advisor + td 3 + tr + td Pawn + td 2 + +h3 More information + +p + | This variant is playable on + a(href="https://www.pychess.org/variant/janggi") + | pychess-variants + | . See also the Wikipedia page. diff --git a/client/src/translations/rules/Janggi/fr.pug b/client/src/translations/rules/Janggi/fr.pug index 21203baa..7cac6b51 100644 --- a/client/src/translations/rules/Janggi/fr.pug +++ b/client/src/translations/rules/Janggi/fr.pug @@ -1 +1,108 @@ -p.boxed TODO +p.boxed + | Échecs coréens, avec un jeu de pièces différant des échecs orthodoxes. + +p. + Les pièces se positionnent sur les intersections plutôt qu'au centre des + cases. L'effet n'est qu'esthétique, il n'y a pas d'impact sur la description + des déplacements. + +p + | La position de départ est presque la même qu'au + a(href="/#/variants/Xiangqi") Xiangqi + | , à l'exception des rois qui se retrouvent au centre des palais. + | De plus, au premier coup vous pouvez choisir d'échanger les positions des + | cavalier et éléphants : d'un seul côté, ou bien des deux. + +p Plus précisément, a premier coup : +ul + li Les blancs peuvent conserver la position initiale en passant, ou + li + | échanger les positions de l'éléphant et du cavalier d'un côté, puis + ul + li passer (en amenant son roi sur le roi adverse), ou + li échanger les pisitions de l'autre côté aussi. +p Ensuite c'est aux noirs de faire de même, puis la partie commence. + +figure.diagram-container + .diagram.diag12 + | fen:rnea1aenr/4k4/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/4K4/RNEA1AENR: + .diagram.diag22 + | fen:rnea1aner/4k4/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/4K4/RENA1AENR: + figcaption Gauche : position initiale. Droite : après réarrangement. + +h3 Déplacements des pièces + +ul + li. + Le Roi se déplace le long des lignes du palais, et ne peut quitter cette + zone. De même pour les Conseillers. + Contrairement au Xiangqi, les rois peuvent se faire face sur une colonne, + mais si cette situation dure deux demi-coups + la partie est déclarée nulle : "bikjang". + li. + Les Tours ("chariots") et Cavaliers ("chevaux") se déplacent comme aux + échecs orthodoxes, mais le cavalier ne saute pas : il avance d'abord + d'une case orthogonalement, puis d'un pas en diagonale. + Si la première est occupée, le coup est impossible. + li. + Les Éléphants se déplacent comme les cavaliers, mais parcourent une case + supplémentaire dans la même direction diagonale : ils atterrissent au + coin opposé d'un rectangle 2 x 3, et + les cases intermédiaires doivent être libres. + li. + Les Canons se déplacent comme des tours mais ont besoin d'une pièce sur + leur chemin pour sauter d'abord. C'est-à-dire qu'ils ne peuvent pas bouger + sur des colonnes ou rangées vides. Ils peuvent seulement atteindre les + cases situées derrière le premier obstacle. + De plus, un canon ne peut sauter par dessus ou capturer un autre canon. + li. + Les Pions se comportent comme des pions promus du Xiangqi : ils se + déplacent d'une case vers l'avant ou latéralement. + +p. + Les canons, tours et pions peuvent aussi se déplacer le long des diagonales + Il est également possible de passer au lieu de jouer un coup. + Deux passes consécutives équivaut à un match nul. + +figure.diagram-container + .diagram.diag12 + | fen:4r4/9/4n4/9/9/2r1Cr2c/9/4C4/9/9 a5,b5,e9,e10,g5,h5: + .diagram.diag22 + | fen:9/9/2r6/9/9/4EP3/3p5/5p3/9/9 b7,b3,c2,c8,g8: + figcaption Gauche : coups du Canon. Droite : coups de l'Éléphant. + +h3 Valeur des pièces + +p Voici les valeurs officielles : + +table + tr + th Piece + th Valeur + tr + td Chariot + td 13 + tr + td Canon + td 7 + tr + td Cheval + td 5 + tr + td Élephant + td 3 + tr + td Conseiller + td 3 + tr + td Pion + td 2 + +h3 Plus d'information + +p + | Cette variante est jouable sur + a(href="https://www.pychess.org/variant/janggi") + | pychess-variants + | . Voir aussi la page Wikipedia. + diff --git a/client/src/translations/rules/Xiangqi/fr.pug b/client/src/translations/rules/Xiangqi/fr.pug index 05f8a402..d2eaf210 100644 --- a/client/src/translations/rules/Xiangqi/fr.pug +++ b/client/src/translations/rules/Xiangqi/fr.pug @@ -1,6 +1,5 @@ p.boxed. - Échecs chinois, avec différentes pièces se comportant - différemment des échecs orthodoxes. + Échecs chinois, avec un jeu de pièces différant des échecs orthodoxes. p. Les pièces se positionnent sur les intersections plutôt qu'au centre des diff --git a/client/src/variants/Janggi.js b/client/src/variants/Janggi.js index 895e23ff..e22a7869 100644 --- a/client/src/variants/Janggi.js +++ b/client/src/variants/Janggi.js @@ -35,10 +35,6 @@ export class JanggiRules extends ChessRules { return false; } - static get LoseOnRepetition() { - return true; - } - static get ELEPHANT() { return "e"; } @@ -110,9 +106,10 @@ export class JanggiRules extends ChessRules { // TODO: next "if" is mutually exclusive with the block above if (this.movesCount <= 1) { const firstRank = (this.movesCount == 0 ? 9 : 0); - const [initFile, destFile] = (this.subTurn == 1 ? [1, 2] : [7, 6]); + const initDestFile = new Map([[1, 2], [7, 6]]); // Only option is knight / elephant swap: - if (x == firstRank && y == initFile) { + if (x == firstRank && !!initDestFile.get(y)) { + const destFile = initDestFile.get(y); moves.push( new Move({ appear: [