From: Benjamin Auder Date: Sat, 22 Feb 2020 12:51:46 +0000 (+0100) Subject: Fix incheck in BaseGame, draft Antimatter variant X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/css/user/doc/pieces/common.css?a=commitdiff_plain;h=8b405c81769b822dd2d0db28c613da259f68c071;p=vchess.git Fix incheck in BaseGame, draft Antimatter variant --- diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index c52f94c8..42fe1897 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -393,6 +393,7 @@ export default { this.vr.re_init(this.moves[index].fen); this.cursor = index; this.lastMove = this.moves[index]; + this.incheck = this.vr.getCheckSquares(this.vr.turn); }, gotoBegin: function() { if (this.cursor == -1) return; @@ -404,6 +405,7 @@ export default { this.cursor = -1; this.lastMove = null; } + this.incheck = this.vr.getCheckSquares(this.vr.turn); }, gotoEnd: function() { if (this.cursor == this.moves.length - 1) return; diff --git a/client/src/translations/en.js b/client/src/translations/en.js index 64ff2b02..df3b1d22 100644 --- a/client/src/translations/en.js +++ b/client/src/translations/en.js @@ -132,6 +132,7 @@ export const translations = { "Capture all of a kind": "Capture all of a kind", "Captures reborn": "Captures reborn", "Change colors": "Change colors", + "Dangerous collisions": "Dangerous collisions", "Exchange pieces positions": "Exchange pieces positions", "Exotic captures": "Exotic captures", "Explosive captures": "Explosive captures", diff --git a/client/src/translations/es.js b/client/src/translations/es.js index 760e644c..5588cbb9 100644 --- a/client/src/translations/es.js +++ b/client/src/translations/es.js @@ -132,6 +132,7 @@ export const translations = { "Capture all of a kind": "Capturar todo del mismo tipo", "Captures reborn": "Las capturas renacen", "Change colors": "Cambiar colores", + "Dangerous collisions": "Colisiones peligrosas", "Exchange pieces positions": "Intercambiar las posiciones de las piezas", "Exotic captures": "Capturas exóticas", "Explosive captures": "Capturas explosivas", diff --git a/client/src/translations/fr.js b/client/src/translations/fr.js index b6906745..ed302bae 100644 --- a/client/src/translations/fr.js +++ b/client/src/translations/fr.js @@ -132,6 +132,7 @@ export const translations = { "Capture all of a kind": "Capturez tout d'un même type", "Captures reborn": "Les captures renaissent", "Change colors": "Changer les couleurs", + "Dangerous collisions": "Collisions dangeureuses", "Exchange pieces positions": "Échangez les positions des pièces", "Exotic captures": "Captures exotiques", "Explosive captures": "Captures explosives", diff --git a/client/src/translations/rules/Antimatter/en.pug b/client/src/translations/rules/Antimatter/en.pug new file mode 100644 index 00000000..3c8e3337 --- /dev/null +++ b/client/src/translations/rules/Antimatter/en.pug @@ -0,0 +1,24 @@ +p.boxed + | If a piece captures one of the same kind, both disappear. + +p. + The defensive power of pawns is thus increased, because they don't fear + captures (by other pawns). + +p. + Endings are also affected quite a lot, and sometimes new threats occur: + on the diagram, 3.Bxg7 wins a pawn because 3...Bxg7 would make both + bishops disappear. + +figure.diagram-container + .diagram + | fen:r1bqkbnr/pp1ppppp/2n5/2p5/8/1P6/PBPPPPPP/RN1QKBNR: + figcaption After 1.b3 c5 2.Bb2 Nc6 + +p This detail excepted, the orthodox chess rules apply. + +h3 Source + +p + a(href="https://www.chessvariants.com/rules/antimatter-chess") Antimatter chess + |  on chessvariants.com. diff --git a/client/src/translations/rules/Antimatter/es.pug b/client/src/translations/rules/Antimatter/es.pug new file mode 100644 index 00000000..60cf1ecb --- /dev/null +++ b/client/src/translations/rules/Antimatter/es.pug @@ -0,0 +1,25 @@ +p.boxed + | Si una pieza captura otra del mismo tipo, las dos desaparecen. + +p. + El poder defensivo de los peones aumenta así, ya que no temen + más capturas (por otros peones). + +p. + Las finales también se ven muy afectadas y, a veces, nuevas amenazas + ocurren: en el diagrama, 3.Bxg7 gana un peón porque 3...Bxg7 causaría + la desaparición de los dos alfiles. + +figure.diagram-container + .diagram + | fen:r1bqkbnr/pp1ppppp/2n5/2p5/8/1P6/PBPPPPPP/RN1QKBNR: + figcaption Después de 1.b3 c5 2.Bb2 Nc6 + +p Excepto por este detalle, se aplican las reglas del ajedrez ortodoxo. + +h3 Fuente + +p + | La + a(href="https://www.chessvariants.com/rules/antimatter-chess") variante Antimateria + |  en chessvariants.com. diff --git a/client/src/translations/rules/Antimatter/fr.pug b/client/src/translations/rules/Antimatter/fr.pug new file mode 100644 index 00000000..1e2dbee1 --- /dev/null +++ b/client/src/translations/rules/Antimatter/fr.pug @@ -0,0 +1,25 @@ +p.boxed + | Si une pièce en capture une autre du même type, les deux disparaissent. + +p. + Le pouvoir défensif des pions est ainsi augmenté, puisqu'ils ne craignent + plus les captures (par d'autres pions). + +p. + Les finales sont aussi beaucoup affectées, et parfois de nouvelles menaces + surviennent : sur le diagramme, 3.Bxg7 gagne un pion car 3...Bxg7 provoquerait + la disparition des deux fous. + +figure.diagram-container + .diagram + | fen:r1bqkbnr/pp1ppppp/2n5/2p5/8/1P6/PBPPPPPP/RN1QKBNR: + figcaption After 1.b3 c5 2.Bb2 Nc6 + +p Ce détail excepté, les règles des échecs orthodoxes s'appliquent. + +h3 Source + +p + | La + a(href="https://www.chessvariants.com/rules/antimatter-chess") variante Antimatière + |  sur chessvariants.com. diff --git a/client/src/translations/rules/Benedict/en.pug b/client/src/translations/rules/Benedict/en.pug index 9f6da6fc..856f3417 100644 --- a/client/src/translations/rules/Benedict/en.pug +++ b/client/src/translations/rules/Benedict/en.pug @@ -6,6 +6,8 @@ p. They change side, until the opponent in turn can attack them. There are no captures: only color changes. +p Castling is possible, and flips pieces attacked by the king or rook. + figure.diagram-container .diagram | fen:r1bqkbnr/ppPpPppp/2n5/3N4/8/8/PPPPPPPP/R1BQKBNR: diff --git a/client/src/translations/rules/Benedict/es.pug b/client/src/translations/rules/Benedict/es.pug index 439d5da1..01c50ed9 100644 --- a/client/src/translations/rules/Benedict/es.pug +++ b/client/src/translations/rules/Benedict/es.pug @@ -2,6 +2,13 @@ p.boxed | Las piezas atacadas cambian de color después de cada turno. | El objetivo es cambiar el color del rey. +p. + Más precisamente, solo las piezas atacadas por la unidad móvil se voltean. + Cambian de lado, hasta que el oponente a su vez puede atacarlos. + No hay capturas: solo cambios de color. + +p El enroque es posible y cambia tanto las piezas atacadas por el rey como la torre. + figure.diagram-container .diagram | fen:r1bqkbnr/ppPpPppp/2n5/3N4/8/8/PPPPPPPP/R1BQKBNR: diff --git a/client/src/translations/rules/Benedict/fr.pug b/client/src/translations/rules/Benedict/fr.pug index 542a1898..cffef96f 100644 --- a/client/src/translations/rules/Benedict/fr.pug +++ b/client/src/translations/rules/Benedict/fr.pug @@ -2,6 +2,13 @@ p.boxed | Les pièces attaquées changent de couleur après chaque tour. | Le but est de changer la couleur du roi. +p. + Plus précisément, seules les pièces attaquées par le coup courant sont modifiées. + Elles changent de couleur, jusqu'à ce que l'adversaire au trait puisse les attaquer. + Il n'y a pas de captures : seulement des changements de couleur. + +p Le roque est possible, et change à la fois les pièces attaquées par le roi et la tour. + figure.diagram-container .diagram | fen:r1bqkbnr/ppPpPppp/2n5/3N4/8/8/PPPPPPPP/R1BQKBNR: diff --git a/client/src/variants/Antimatter.js b/client/src/variants/Antimatter.js new file mode 100644 index 00000000..63d5ae56 --- /dev/null +++ b/client/src/variants/Antimatter.js @@ -0,0 +1,20 @@ +import { ChessRules } from "@/base_rules"; + +export const VariantRules = class AntimatterRules extends ChessRules { + getPotentialMovesFrom([x, y]) { + let moves = super.getPotentialMovesFrom([x, y]); + + // Handle "matter collisions" + moves.forEach(m => { + if ( + m.vanish.length > 1 && + m.appear.length <= 1 && + m.vanish[0].p == m.vanish[1].p + ) { + m.appear.pop(); + } + }); + + return moves; + } +}; diff --git a/client/src/variants/Atomic.js b/client/src/variants/Atomic.js index 996f2d1a..2fcb5a6b 100644 --- a/client/src/variants/Atomic.js +++ b/client/src/variants/Atomic.js @@ -6,9 +6,9 @@ export const VariantRules = class AtomicRules extends ChessRules { // Handle explosions moves.forEach(m => { + // NOTE: if vanish.length==2 and appear.length==2, this is castle if (m.vanish.length > 1 && m.appear.length <= 1) { - //avoid castles - // Explosion! OPTION (TODO?): drop moves which explode our king here + // Explosion! (TODO?: drop moves which explode our king here) let steps = [ [-1, -1], [-1, 0], diff --git a/server/db/populate.sql b/server/db/populate.sql index 34d0f44e..3fea093a 100644 --- a/server/db/populate.sql +++ b/server/db/populate.sql @@ -3,6 +3,7 @@ insert or ignore into Variants (name,description) values ('Alice', 'Both sides of the mirror'), ('Antiking', 'Keep antiking in check'), + ('Antimatter', 'Dangerous collisions'), ('Atomic', 'Explosive captures'), ('Baroque', 'Exotic captures'), ('Benedict', 'Change colors'),