From: Benjamin Auder Date: Mon, 30 Mar 2020 21:34:05 +0000 (+0200) Subject: Clarify Synchrone rules X-Git-Url: https://git.auder.net/?p=vchess.git;a=commitdiff_plain;h=d448f93296ce2a4fcc6f2fbb959ec2485e172432 Clarify Synchrone rules --- diff --git a/client/src/translations/rules/Synchrone/en.pug b/client/src/translations/rules/Synchrone/en.pug index 3344652e..b72064b4 100644 --- a/client/src/translations/rules/Synchrone/en.pug +++ b/client/src/translations/rules/Synchrone/en.pug @@ -24,6 +24,17 @@ figure.diagram-container | fen:rnb1kbnr/ppp1pppp/8/3qP3/8/8/PPPP1PPP/RNBQKBNR: figcaption After 1.e4 d5 2.e5 Qxd5 (anticipating 2.exd5 which isn't played) +p. + When the king is under check, a legal orthodox move must be played. + Some weird situations would occur otherwise, like on the following diagram. + If we allow self-(re)captures then the king would take on h2 and escape to + the third rank. + +figure.diagram-container + .diagram + | fen:7k/8/8/3QR3/3P4/4P3/r6P/q6K: + figcaption 1.Kxh2 by anticipation isn't allowed: white is checkmated. + h3 End of the game p. diff --git a/client/src/translations/rules/Synchrone/es.pug b/client/src/translations/rules/Synchrone/es.pug index 1a98c95d..d9963a21 100644 --- a/client/src/translations/rules/Synchrone/es.pug +++ b/client/src/translations/rules/Synchrone/es.pug @@ -25,6 +25,17 @@ figure.diagram-container | fen:rnb1kbnr/ppp1pppp/8/3qP3/8/8/PPPP1PPP/RNBQKBNR: figcaption Después de 1.e4 d5 2.e5 Qxd5 (anticipando 2.exd5 que no se juega) +p. + Cuando el rey está en jaque, un movimiento legal de acuerdo con las reglas + ortodoxas debe ser jugado. Situaciones extrañas pueden ocurrir de otra + manera, como en el siguiente diagrama. Si permitimos las auto-(re)capturas, + entonces el rey toma en h2 y escapa por la tercera fila. + +figure.diagram-container + .diagram + | fen:7k/8/8/3QR3/3P4/4P3/r6P/q6K: + figcaption 1.Kxh2 por adelantado no está permitido: las blancas son mate. + h3 Fin de la partida p. diff --git a/client/src/translations/rules/Synchrone/fr.pug b/client/src/translations/rules/Synchrone/fr.pug index df48a123..f60ff48d 100644 --- a/client/src/translations/rules/Synchrone/fr.pug +++ b/client/src/translations/rules/Synchrone/fr.pug @@ -25,6 +25,17 @@ figure.diagram-container | fen:rnb1kbnr/ppp1pppp/8/3qP3/8/8/PPPP1PPP/RNBQKBNR: figcaption Après 1.e4 d5 2.e5 Qxd5 (anticipant 2.exd5 qui n'est pas joué) +p. + Quand le roi est en échec, un coup légal selon les règles orthodoxes doit + être joué. Des situations bizarres peuvent arriver sinon, comme sur le + diagramme suivant. Si on autorise les auto-(re)captures alors le roi prend + en h2 et s'échappe par la troisème rangée. + +figure.diagram-container + .diagram + | fen:7k/8/8/3QR3/3P4/4P3/r6P/q6K: + figcaption 1.Kxh2 par anticipation n'est pas autorisé : les blancs sont mat. + h3 Fin de la partie p. diff --git a/client/src/variants/Synchrone.js b/client/src/variants/Synchrone.js index 1af9379f..70afa0e5 100644 --- a/client/src/variants/Synchrone.js +++ b/client/src/variants/Synchrone.js @@ -107,11 +107,11 @@ export class SynchroneRules extends ChessRules { } getPossibleMovesFrom([x, y]) { - return ( - this.filterValid(super.getPotentialMovesFrom([x, y])) - // Augment with potential recaptures: - .concat(this.getRecaptures([x, y])) - ); + let moves = this.filterValid(super.getPotentialMovesFrom([x, y])); + if (!this.underCheck(this.getColor(x, y))) + // Augment with potential recaptures, except if we are under check + Array.prototype.push.apply(moves, this.getRecaptures([x, y])); + return moves; } // Aux function used to find opponent and self captures