From: Benjamin Auder Date: Fri, 15 Jan 2021 21:07:24 +0000 (+0100) Subject: A few fixes X-Git-Url: https://git.auder.net/assets/img/current/pieces/cp.svg?a=commitdiff_plain;h=5d74fceaa93054b410f469fe6ed4d5a4609bf98d;p=vchess.git A few fixes --- diff --git a/client/src/translations/fr.js b/client/src/translations/fr.js index 5b704056..6484ba00 100644 --- a/client/src/translations/fr.js +++ b/client/src/translations/fr.js @@ -298,7 +298,8 @@ export const translations = { "Squat last rank (v2)": "Occupez la dernière rangée (v2)", "Standard rules": "Règles usuelles", "Stun & kick pieces": "Étourdissez & frappez les pièces", - "Thai Chess": "Échecs thai", + "Thai Chess (v1)": "Échecs thai (v1)", + "Thai Chess (v2)": "Échecs thai (v2)", "The colorbound clobberers": "Les tabasseurs unicolores", "The end of the world": "La fin du monde", "Transform an essay": "Transformer un essai", diff --git a/client/src/translations/rules/Checkered1/en.pug b/client/src/translations/rules/Checkered1/en.pug index 8ea482cc..68d39681 100644 --- a/client/src/translations/rules/Checkered1/en.pug +++ b/client/src/translations/rules/Checkered1/en.pug @@ -48,11 +48,8 @@ h3 Pawns ul li. Pawns can jump two squares only from their initial rank, and only once in - the game: a checkered pawn returning on the pawns' start rank cannot jump. - However: - li. - A pawn captured on its starting square (thus becoming "checkered") keeps - the right to advance two squares. + the game. A checkered pawn keeps this right if the starting pawn + did not use it. li. Checkered pawns cannot capture en passant, because while the pawn was "passing" they were of the same color. diff --git a/client/src/translations/rules/Checkered1/es.pug b/client/src/translations/rules/Checkered1/es.pug index eb1b26f6..403a20f7 100644 --- a/client/src/translations/rules/Checkered1/es.pug +++ b/client/src/translations/rules/Checkered1/es.pug @@ -45,13 +45,9 @@ h3 Peones ul li. - Los peones pueden avanzar solo dos espacios desde su fila - punto de partida, y solo una vez en el juego: un peón a cuadros - volver a una fila inicial no puede avanzar dos espacios. - Sin embargo: - li. - Un peón a cuadros de una captura en la fila inicial mantiene - el derecho a avanzar dos espacios. + Los peones pueden avanzar dos espacios solo desde su fila + punto de partida, y solo una vez en el juego. Un peón a cuadros + retiene este derecho si el peón inicial no lo ha usado. li. Los peones a cuadros no pueden capturar en passant, ya que mientras el peón contrario "pasó" estaban en el mismo campamento. diff --git a/client/src/translations/rules/Checkered1/fr.pug b/client/src/translations/rules/Checkered1/fr.pug index 380f15ce..9e848c34 100644 --- a/client/src/translations/rules/Checkered1/fr.pug +++ b/client/src/translations/rules/Checkered1/fr.pug @@ -51,12 +51,8 @@ h3 Pions ul li. Les pions peuvent avancer de deux cases seulement depuis leur rangée - de départ, et ce une seule fois dans la partie : un pion échiqueté - revenant sur une rangée de départ ne peut pas avancer de deux cases. - Cependant : - li. - Un pion échiqueté issu d'une capture sur la rangée de départ garde - le droit d'avancer de deux cases. + de départ, et ce une seule fois dans la partie. Un pion échiqueté + conserve ce droit si le pion initial ne l'a pas utilisé. li. Les pions échiquetés ne peuvent capturer en passant, puisque pendant que le pion adverse "passait" ils étaient dans le même camp. diff --git a/client/src/translations/rules/Refusal/en.pug b/client/src/translations/rules/Refusal/en.pug new file mode 100644 index 00000000..3a33838b --- /dev/null +++ b/client/src/translations/rules/Refusal/en.pug @@ -0,0 +1,2 @@ +p.boxed + | TODO diff --git a/client/src/translations/rules/Refusal/es.pug b/client/src/translations/rules/Refusal/es.pug new file mode 100644 index 00000000..3a33838b --- /dev/null +++ b/client/src/translations/rules/Refusal/es.pug @@ -0,0 +1,2 @@ +p.boxed + | TODO diff --git a/client/src/translations/rules/Refusal/fr.pug b/client/src/translations/rules/Refusal/fr.pug new file mode 100644 index 00000000..3a33838b --- /dev/null +++ b/client/src/translations/rules/Refusal/fr.pug @@ -0,0 +1,2 @@ +p.boxed + | TODO diff --git a/client/src/variants/Ambiguous.js b/client/src/variants/Ambiguous.js index 36824db8..b478887d 100644 --- a/client/src/variants/Ambiguous.js +++ b/client/src/variants/Ambiguous.js @@ -250,8 +250,10 @@ export class AmbiguousRules extends ChessRules { if (rem2 == positions[1] % 2) { // Fix bishops (on different colors) for (let i=2; i<8; i++) { - if (positions[i] % 2 != rem2) + if (positions[i] % 2 != rem2) { [positions[1], positions[i]] = [positions[i], positions[1]]; + break; + } } } for (let i = 0; i < 8; i++) pieces[c][positions[i]] = composition[i]; diff --git a/client/src/variants/Ball.js b/client/src/variants/Ball.js index 5de871d7..fb2172b1 100644 --- a/client/src/variants/Ball.js +++ b/client/src/variants/Ball.js @@ -205,8 +205,10 @@ export class BallRules extends ChessRules { if (rem2 == positions[1] % 2) { // Fix bishops (on different colors) for (let i=4; i<9; i++) { - if (positions[i] % 2 != rem2) + if (positions[i] % 2 != rem2) { [positions[1], positions[i]] = [positions[i], positions[1]]; + break; + } } } rem2 = positions[2] % 2; diff --git a/client/src/variants/Checkered1.js b/client/src/variants/Checkered1.js index 71f9b920..2451f9b5 100644 --- a/client/src/variants/Checkered1.js +++ b/client/src/variants/Checkered1.js @@ -504,9 +504,14 @@ export class Checkered1Rules extends ChessRules { this.kingPos[c][1] = move.appear[0].y; } super.updateCastleFlags(move, piece); - // Does this move turn off a 2-squares pawn flag? - if ([1, 6].includes(move.start.x) && move.vanish[0].p == V.PAWN) + if ( + [1, 6].includes(move.start.x) && + move.vanish[0].p == V.PAWN && + Math.abs(move.end.x - move.start.x) == 2 + ) { + // This move turns off a 2-squares pawn flag this.pawnFlags[move.start.x == 6 ? "w" : "b"][move.start.y] = false; + } } this.cmoves.push(this.getCmove(move)); } diff --git a/client/src/variants/Checkered2.js b/client/src/variants/Checkered2.js index 9c883f71..997c1c7a 100644 --- a/client/src/variants/Checkered2.js +++ b/client/src/variants/Checkered2.js @@ -351,8 +351,13 @@ export class Checkered2Rules extends ChessRules { postPlay(move) { super.postPlay(move); // Does this move turn off a 2-squares pawn flag? - if ([1, 6].includes(move.start.x) && move.vanish[0].p == V.PAWN) + if ( + [1, 6].includes(move.start.x) && + move.vanish[0].p == V.PAWN && + Math.abs(move.end.x - move.start.x) == 2 + ) { this.pawnFlags[move.start.x == 6 ? "w" : "b"][move.start.y] = false; + } this.cmoves.push(this.getCmove(move)); } diff --git a/client/src/variants/Circular.js b/client/src/variants/Circular.js index aa700bb1..47758442 100644 --- a/client/src/variants/Circular.js +++ b/client/src/variants/Circular.js @@ -56,8 +56,10 @@ export class CircularRules extends ChessRules { if (rem2 == positions[1] % 2) { // Fix bishops (on different colors) for (let i=2; i<8; i++) { - if (positions[i] % 2 != rem2) + if (positions[i] % 2 != rem2) { [positions[1], positions[i]] = [positions[i], positions[1]]; + break; + } } } for (let i = 0; i < 8; i++) pieces[c][positions[i]] = composition[i]; diff --git a/client/src/variants/Diamond.js b/client/src/variants/Diamond.js index 415a6aa3..1aa9b0ef 100644 --- a/client/src/variants/Diamond.js +++ b/client/src/variants/Diamond.js @@ -28,8 +28,10 @@ export class DiamondRules extends ChessRules { if (rem2 == positions[1] % 2) { // Fix bishops (on different colors) for (let i=2; i<8; i++) { - if (positions[i] % 2 != rem2) + if (positions[i] % 2 != rem2) { [positions[1], positions[i]] = [positions[i], positions[1]]; + break; + } } } for (let i = 0; i < 8; i++) pieces[c][positions[i]] = composition[i]; diff --git a/client/src/variants/Football.js b/client/src/variants/Football.js index a6630584..2410f0a6 100644 --- a/client/src/variants/Football.js +++ b/client/src/variants/Football.js @@ -108,7 +108,6 @@ export class FootballRules extends ChessRules { if (randomness == 0) return "rnbq1knbr/9/9/9/4a4/9/9/9/RNBQ1KNBR w 0"; - // TODO: following is mostly copy-paste from Suicide variant let pieces = { w: new Array(8), b: new Array(8) }; for (let c of ["w", "b"]) { if (c == 'b' && randomness == 1) { @@ -119,12 +118,16 @@ export class FootballRules extends ChessRules { // Get random squares for every piece, totally freely let positions = shuffle(ArrayFun.range(8)); const composition = ['b', 'b', 'r', 'r', 'n', 'n', 'k', 'q']; - const rem2 = positions[0] % 2; - if (rem2 == positions[1] % 2) { - // Fix bishops (on different colors) + // Fix bishops (on different colors) + const realOddity = + (pos) => { return (pos <= 3 ? pos % 2 : (pos + 1) % 2); }; + const rem2 = realOddity(positions[0]); + if (rem2 == realOddity(positions[1])) { for (let i=2; i<8; i++) { - if (positions[i] % 2 != rem2) + if (realOddity(positions[i]) != rem2) { [positions[1], positions[i]] = [positions[i], positions[1]]; + break; + } } } for (let i = 0; i < 8; i++) pieces[c][positions[i]] = composition[i]; diff --git a/client/src/variants/Suicide.js b/client/src/variants/Suicide.js index e71e3a2e..13aaa6bb 100644 --- a/client/src/variants/Suicide.js +++ b/client/src/variants/Suicide.js @@ -153,8 +153,10 @@ export class SuicideRules extends ChessRules { if (rem2 == positions[1] % 2) { // Fix bishops (on different colors) for (let i=2; i<8; i++) { - if (positions[i] % 2 != rem2) + if (positions[i] % 2 != rem2) { [positions[1], positions[i]] = [positions[i], positions[1]]; + break; + } } } for (let i = 0; i < 8; i++) pieces[c][positions[i]] = composition[i];