From 57d9b2c4f08948bd5a5fc4a01a0b62d4c80523e2 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Tue, 24 Mar 2020 19:27:47 +0100 Subject: [PATCH] Some fixes --- client/public/images/pieces/Ball/bc.svg | 78 +++++++-------- client/public/images/pieces/Ball/bd.svg | 77 +++++++-------- client/public/images/pieces/Ball/bh.svg | 35 ++++--- client/public/images/pieces/Ball/wc.svg | 93 +++--------------- client/public/images/pieces/Ball/wd.svg | 94 +++++++++++++++---- client/public/images/pieces/Ball/wh.svg | 9 +- client/src/base_rules.js | 2 +- client/src/components/BaseGame.vue | 2 +- client/src/components/ComputerGame.vue | 3 +- client/src/translations/rules/Coregal/en.pug | 9 +- client/src/translations/rules/Coregal/es.pug | 10 +- client/src/translations/rules/Coregal/fr.pug | 16 +++- .../src/translations/rules/Enpassant/en.pug | 21 ++++- .../src/translations/rules/Enpassant/es.pug | 27 ++++-- .../src/translations/rules/Enpassant/fr.pug | 27 ++++-- client/src/variants/Arena.js | 3 + client/src/variants/Checkered.js | 36 +++---- client/src/variants/Extinction.js | 2 - client/src/variants/Losers.js | 4 +- 19 files changed, 293 insertions(+), 255 deletions(-) diff --git a/client/public/images/pieces/Ball/bc.svg b/client/public/images/pieces/Ball/bc.svg index 03c42738..6dbea895 100644 --- a/client/public/images/pieces/Ball/bc.svg +++ b/client/public/images/pieces/Ball/bc.svg @@ -11,11 +11,11 @@ width="100%" version="1.1" viewBox="0 0 2048 2048" - id="svg16" - sodipodi:docname="bc.svg" + id="svg112" + sodipodi:docname="bh.svg" inkscape:version="0.92.4 5da689c313, 2019-01-14"> + id="metadata118"> @@ -27,7 +27,7 @@ + id="defs116" /> + inkscape:current-layer="svg112" /> + id="path96" + inkscape:connector-curvature="0" /> + id="g110" + transform="matrix(1,0,0,-1,0,2008)" + style="fill:#ffffff;fill-rule:nonzero"> + + id="path100" + inkscape:connector-curvature="0" /> + id="path102" + inkscape:connector-curvature="0" /> + id="path104" + inkscape:connector-curvature="0" /> + id="path106" + inkscape:connector-curvature="0" /> + id="path108" + inkscape:connector-curvature="0" /> - diff --git a/client/public/images/pieces/Ball/bd.svg b/client/public/images/pieces/Ball/bd.svg index 8c5339cc..03c42738 100644 --- a/client/public/images/pieces/Ball/bd.svg +++ b/client/public/images/pieces/Ball/bd.svg @@ -11,11 +11,11 @@ width="100%" version="1.1" viewBox="0 0 2048 2048" - id="svg18" - sodipodi:docname="bd.svg" + id="svg16" + sodipodi:docname="bc.svg" inkscape:version="0.92.4 5da689c313, 2019-01-14"> + id="metadata22"> @@ -27,7 +27,7 @@ + id="defs20" /> + inkscape:current-layer="svg16" /> + fill="#000" + id="path2" /> - + fill-rule="nonzero" + fill="#fff" + id="g14"> + id="path4" /> + id="path6" /> + id="path8" /> + id="path10" /> + id="path12" /> diff --git a/client/public/images/pieces/Ball/bh.svg b/client/public/images/pieces/Ball/bh.svg index 6dbea895..8c5339cc 100644 --- a/client/public/images/pieces/Ball/bh.svg +++ b/client/public/images/pieces/Ball/bh.svg @@ -11,11 +11,11 @@ width="100%" version="1.1" viewBox="0 0 2048 2048" - id="svg112" - sodipodi:docname="bh.svg" + id="svg18" + sodipodi:docname="bd.svg" inkscape:version="0.92.4 5da689c313, 2019-01-14"> + id="metadata24"> @@ -27,7 +27,7 @@ + id="defs22" /> + inkscape:current-layer="svg18" /> + diff --git a/client/public/images/pieces/Ball/wc.svg b/client/public/images/pieces/Ball/wc.svg index b51dea5a..eac3db53 100644 --- a/client/public/images/pieces/Ball/wc.svg +++ b/client/public/images/pieces/Ball/wc.svg @@ -11,11 +11,11 @@ width="100%" version="1.1" viewBox="0 0 2048 2048" - id="svg18" - sodipodi:docname="wc.svg" + id="svg6" + sodipodi:docname="wh.svg" inkscape:version="0.92.4 5da689c313, 2019-01-14"> + id="metadata12"> @@ -27,7 +27,7 @@ + id="defs10" /> + inkscape:current-layer="svg6" /> - - - - - - - - - - - - - diff --git a/client/public/images/pieces/Ball/wd.svg b/client/public/images/pieces/Ball/wd.svg index d10a14fe..b51dea5a 100644 --- a/client/public/images/pieces/Ball/wd.svg +++ b/client/public/images/pieces/Ball/wd.svg @@ -11,11 +11,11 @@ width="100%" version="1.1" viewBox="0 0 2048 2048" - id="svg6" - sodipodi:docname="wd.svg" + id="svg18" + sodipodi:docname="wc.svg" inkscape:version="0.92.4 5da689c313, 2019-01-14"> + id="metadata24"> @@ -27,7 +27,7 @@ + id="defs22" /> + inkscape:current-layer="svg18" /> + fill="#fff" + id="path2" /> + + + + + + + + + + + + diff --git a/client/public/images/pieces/Ball/wh.svg b/client/public/images/pieces/Ball/wh.svg index eac3db53..d10a14fe 100644 --- a/client/public/images/pieces/Ball/wh.svg +++ b/client/public/images/pieces/Ball/wh.svg @@ -12,7 +12,7 @@ version="1.1" viewBox="0 0 2048 2048" id="svg6" - sodipodi:docname="wh.svg" + sodipodi:docname="wd.svg" inkscape:version="0.92.4 5da689c313, 2019-01-14"> @@ -42,7 +42,7 @@ id="namedview8" showgrid="false" inkscape:zoom="0.11523438" - inkscape:cx="1041.3559" + inkscape:cx="1058.7119" inkscape:cy="1024" inkscape:window-x="0" inkscape:window-y="20" @@ -60,4 +60,9 @@ display="block" id="path4" inkscape:connector-curvature="0" /> + diff --git a/client/src/base_rules.js b/client/src/base_rules.js index 6da3212f..e1428399 100644 --- a/client/src/base_rules.js +++ b/client/src/base_rules.js @@ -226,7 +226,7 @@ export const ChessRules = class ChessRules { if ( Math.abs(s.x - e.x) == 2 && s.y == e.y && - move.appear[0].p == V.PAWN + (move.appear.length > 0 && move.appear[0].p == V.PAWN) ) { return { x: (s.x + e.x) / 2, diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue index 4a451f4f..d9540eb3 100644 --- a/client/src/components/BaseGame.vue +++ b/client/src/components/BaseGame.vue @@ -387,7 +387,7 @@ export default { }; const playMove = () => { const animate = ( - V.ShowMoves == "all" && + ["all", "highlight"].includes(V.ShowMoves) && (this.autoplay || !!received) ); if (!Array.isArray(move)) move = [move]; diff --git a/client/src/components/ComputerGame.vue b/client/src/components/ComputerGame.vue index 5fe29e6f..ccf3a133 100644 --- a/client/src/components/ComputerGame.vue +++ b/client/src/components/ComputerGame.vue @@ -65,8 +65,7 @@ export default { if (this.gameInfo.mode == "versus") CompgameStorage.add(game); } - if (this.gameInfo.mode == "versus" && !game.mycolor) - game.mycolor = (Math.random() < 0.5 ? "w" : "b"); + if (!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/Coregal/en.pug b/client/src/translations/rules/Coregal/en.pug index e9eb1ed8..f7252254 100644 --- a/client/src/translations/rules/Coregal/en.pug +++ b/client/src/translations/rules/Coregal/en.pug @@ -11,11 +11,13 @@ ul p. Since the king remains royal, this allows a new way to win: check both - royal pieces at the same time, like on the following diagram. + royal pieces at the same time, like on the following diagrams. figure.diagram-container - .diagram + .diagram.diag12 | fen:4Q3/4K3/8/8/3N4/5k2/2q5/8: + .diagram.diag22 + | fen:n2rb1r1/1Qn2p2/5qp1/3p4/P1P2PNp/BP2k2P/R3P1P1/1K4RB: figcaption Both black king and queen are in check: white wins. h3 Special moves @@ -42,7 +44,8 @@ p. h3 Source p - a(href="https://www.chessvariants.com/winning.dir/coregal.html") Coregal Chess + a(href="https://www.chessvariants.com/winning.dir/coregal.html") + | Coregal Chess |  on chessvariants.com. | This variant can be played too a(href="https://greenchess.net/rules.php?v=coregal") on greenchess.net diff --git a/client/src/translations/rules/Coregal/es.pug b/client/src/translations/rules/Coregal/es.pug index f7484e8a..d332f972 100644 --- a/client/src/translations/rules/Coregal/es.pug +++ b/client/src/translations/rules/Coregal/es.pug @@ -12,11 +12,14 @@ ul p. Como el rey sigue siendo real, esto agrega una nueva forma de ganar: - jaque las dos piezas reales al mismo tiempo, como en el siguiente diagrama. + jaque las dos piezas reales al mismo tiempo, + como en los siguientes diagramas. figure.diagram-container - .diagram + .diagram.diag12 | fen:4Q3/4K3/8/8/3N4/5k2/2q5/8: + .diagram.diag22 + | fen:n2rb1r1/1Qn2p2/5qp1/3p4/P1P2PNp/BP2k2P/R3P1P1/1K4RB: figcaption Las blancas ganan porque el rey y la dama negra están en jaque. h3 Movimientos especiales @@ -44,7 +47,8 @@ h3 Fuente p | La - a(href="https://www.chessvariants.com/winning.dir/coregal.html") cariante Coregal + a(href="https://www.chessvariants.com/winning.dir/coregal.html") + | variante Coregal |  en chessvariants.com. | Esta variante también es jugable a(href="https://greenchess.net/rules.php?v=coregal") en greenchess.net diff --git a/client/src/translations/rules/Coregal/fr.pug b/client/src/translations/rules/Coregal/fr.pug index 47247f15..f91bf534 100644 --- a/client/src/translations/rules/Coregal/fr.pug +++ b/client/src/translations/rules/Coregal/fr.pug @@ -1,7 +1,10 @@ p.boxed - | On peut gagner en matant la dame. Une dame ne peut aller ou rester en échec. + | On peut gagner en matant la dame. + | Une dame ne peut aller ou rester en échec. -p Tout comme le roi, la dame peut être mise en échec et matée. C'est-à-dire que +p. + Tout comme le roi, la dame peut être mise en échec et matée. + C'est-à-dire que ul li Un coup qui laisserait l'adversaire capturer la dame est interdit. li. @@ -12,11 +15,13 @@ ul p. Puisque le roi reste royal, ceci ajoute une nouvelle manière de gagner : mettre en échc les deux pièces royales en même temps, - comme sur le diagramme suivant. + comme sur les diagrammes suivants. figure.diagram-container - .diagram + .diagram.diag12 | fen:4Q3/4K3/8/8/3N4/5k2/2q5/8: + .diagram.diag22 + | fen:n2rb1r1/1Qn2p2/5qp1/3p4/P1P2PNp/BP2k2P/R3P1P1/1K4RB: figcaption Les blancs gagnent car le roi et la dame noir sont en échec. h3 Coups spéciaux @@ -44,7 +49,8 @@ h3 Source p | La - a(href="https://www.chessvariants.com/winning.dir/coregal.html") variante Coregal + a(href="https://www.chessvariants.com/winning.dir/coregal.html") + | variante Coregal |  sur chessvariants.com. | Cette variante est jouable également a(href="https://greenchess.net/rules.php?v=coregal") sur greenchess.net diff --git a/client/src/translations/rules/Enpassant/en.pug b/client/src/translations/rules/Enpassant/en.pug index 5d82f43a..2ba1e656 100644 --- a/client/src/translations/rules/Enpassant/en.pug +++ b/client/src/translations/rules/Enpassant/en.pug @@ -11,15 +11,25 @@ ul Even if the capturer gets captured en passant on next turn, the initial captured piece does not return to the board. -p This is a generalisation of the pawn en passant capture, which is still possible. +p. + This is a generalisation of en passant capture with the pawn, which is + still possible. It leads to some unexpected situations, + like on the following diagram after 1...Rb2-d2+: this is not a mate + since the king can capture the rook en passant on c2: 2.Kxc2 e.p. + +figure.diagram-container + .diagram + | fen:6k1/1p1p4/6p1/4P3/2n5/3nP1b1/3r1BP1/R2K1R1B: + figcaption After 1...Rb2-d2+: not a mate! h3 Special moves ul li. - Knights become knightriders, which may make multi knight-steps in the same direction. - For example in the standard initial position, the knightrider on g1 - can go to e5 or capture d7 in addition to the knight moves (see diagram below). + Knights become knightriders, which may make multi knight-steps in the + same direction. For example in the standard initial position, + the knightrider on g1 can go to e5 or could capture on d7 in addition + to the knight moves (see diagram below). li The king can capture a piece en passant by making a knight move. figure.diagram-container @@ -43,7 +53,8 @@ figure.diagram-container h3 Source p - a(href="https://www.chessvariants.com/difftaking.dir/enpassant.html") En Passant chess + a(href="https://www.chessvariants.com/difftaking.dir/enpassant.html") + | En Passant chess |  on chessvariants.com. p Inventor: Andy Kurnia (1998) diff --git a/client/src/translations/rules/Enpassant/es.pug b/client/src/translations/rules/Enpassant/es.pug index e36baaac..50770d18 100644 --- a/client/src/translations/rules/Enpassant/es.pug +++ b/client/src/translations/rules/Enpassant/es.pug @@ -9,10 +9,19 @@ ul esta captura solo es posible inmediatamente después del movimiento (misma condición que para capturar peones en passant). li. - Incluso si el capturador se encuentra capturado en el siguiente movimiento, - la pieza inicialmente capturada no vuelve al tablero. + Incluso si el capturador se encuentra capturado en el siguiente + movimiento, la pieza inicialmente capturada no vuelve al tablero. -p Es una generalización de la captura en passant de los peones, que sigue siendo posible. +p. + Es una generalización de la captura en passant de los peones, + que sigue siendo posible. Esto lleva a algunas situaciones inesperadas, + como en el siguiente diagrama después de 1...Rb2-d2+: no es un mate desde + el rey puede tomar la torre en passant en c2: 2.Kxc2 e.p. + +figure.diagram-container + .diagram + | fen:6k1/1p1p4/6p1/4P3/2n5/3nP1b1/3r1BP1/R2K1R1B: + figcaption Despues de 1...Rb2-d2+: no es jaque mate! h3 Movimientos especiales @@ -21,8 +30,10 @@ ul Los caballos se convierten en caballeros, capaces de realizar varias saltos en la misma dirección. Por ejemplo en la posición inicial, el caballero en g1 puede ir a e5 - o tomar d7 además de los movimientos de caballo. - li El rey puede capturar una pieza en passant haciendo un movimiento de caballo. + o podría tomar en d7 además de los movimientos de caballo. + li. + El rey puede capturar una pieza en passant haciendo + un movimiento de caballo. figure.diagram-container .diagram @@ -36,7 +47,8 @@ p. un jaque o incluso un jaque mate sería posible en el primer movimiento. En el diagrama a continuación 1.Nxe7 es mate, y las negras al turno podría jugar 1...Nxg2 atrapando a la dama. - Es por eso que las capturas solo están autorizadas desde el segundo movimiento. + Es por eso que las capturas solo están autorizadas + desde el segundo movimiento. figure.diagram-container .diagram @@ -47,7 +59,8 @@ h3 Fuente p | La - a(href="https://www.chessvariants.com/difftaking.dir/enpassant.html") variante En Passant + a(href="https://www.chessvariants.com/difftaking.dir/enpassant.html") + | variante En Passant |  en chessvariants.com. p Inventor: Andy Kurnia (1998) diff --git a/client/src/translations/rules/Enpassant/fr.pug b/client/src/translations/rules/Enpassant/fr.pug index 64a07615..1a818f70 100644 --- a/client/src/translations/rules/Enpassant/fr.pug +++ b/client/src/translations/rules/Enpassant/fr.pug @@ -1,5 +1,6 @@ p.boxed - | Toutes les pièces peuvent être capturées en passant, par n'importe quelle pièce. + | Toutes les pièces peuvent être capturées en passant, + | par n'importe quelle pièce. p Plus précisément : ul @@ -12,7 +13,16 @@ ul Même si le capturant se retrouve capturé au coup suivant, la pièce initialement capturée ne revient pas sur l'échiquier. -p C'est une généralisation de la prise en passant des pions, qui reste possible. +p. + C'est une généralisation de la prise en passant des pions, + qui reste possible. Cela mène à certaines situations inattendues, comme + sur le diagramme suivant après 1...Rb2-d2+ : ce n'est pas un mat puisque + le roi peut prendre la tour en passant en c2 : 2.Kxc2 e.p. + +figure.diagram-container + .diagram + | fen:6k1/1p1p4/6p1/4P3/2n5/3nP1b1/3r1BP1/R2K1R1B: + figcaption Après 1...Rb2-d2+ : pas un mat ! h3 Coups spéciaux @@ -20,9 +30,11 @@ ul li. Les cavaliers deviennent des chevaliers, pouvant effectuer plusieurs déplacements de cavalier dans la même direction. - Par exemple dans la position initiale, le chevalier en g1 peut aller en e5 - ou prendre d7 en plus des coups de cavalier. - li Le roi peut capturer une pièce en passant en effectuant un coup de cavalier. + Par exemple dans la position initiale, le chevalier en g1 peut aller + en e5 ou pourrait prendre en d7 en plus des coups de cavalier. + li. + Le roi peut capturer une pièce en passant en effectuant + un coup de cavalier. figure.diagram-container .diagram @@ -34,7 +46,7 @@ figure.diagram-container p. Les déplacements du cavalier étant augmentés, une capture, un échec ou même un mat seraient possibles au premier coup. - Sur le diagramme ci-dessous 1.Nxe7 fait mat, et les noirsau trait + Sur le diagramme ci-dessous 1.Nxe7 fait mat, et les noirs au trait pourraient jouer 1...Nxg2 piégeant la dame. C'est pourquoi les captures ne sont autorisées qu'à partir du second coup. @@ -47,7 +59,8 @@ h3 Source p | La - a(href="https://www.chessvariants.com/difftaking.dir/enpassant.html") variante En Passant + a(href="https://www.chessvariants.com/difftaking.dir/enpassant.html") + | variante En Passant |  sur chessvariants.com. p Inventeur : Andy Kurnia (1998) diff --git a/client/src/variants/Arena.js b/client/src/variants/Arena.js index 33940b83..7cfda1d0 100644 --- a/client/src/variants/Arena.js +++ b/client/src/variants/Arena.js @@ -100,6 +100,9 @@ export class ArenaRules extends ChessRules { return moves; } + postPlay() {} //no kingPos no castleFlags + postUndo() {} + getCurrentScore() { const color = this.turn; if (!this.atLeastOneMove()) diff --git a/client/src/variants/Checkered.js b/client/src/variants/Checkered.js index 799c3e54..bca365d0 100644 --- a/client/src/variants/Checkered.js +++ b/client/src/variants/Checkered.js @@ -429,37 +429,25 @@ export class CheckeredRules extends ChessRules { return "0-0"; } - // Translate final square const finalSquare = V.CoordsToSquare(move.end); - const piece = this.getPiece(move.start.x, move.start.y); + let notation = ""; if (piece == V.PAWN) { // Pawn move - let notation = ""; if (move.vanish.length > 1) { // Capture const startColumn = V.CoordToColumn(move.start.y); - notation = - startColumn + - "x" + - finalSquare + - "=" + - move.appear[0].p.toUpperCase(); - } //no capture - else { - notation = finalSquare; - if (move.appear.length > 0 && piece != move.appear[0].p) - //promotion - notation += "=" + move.appear[0].p.toUpperCase(); - } - return notation; + notation = startColumn + "x" + finalSquare; + } else notation = finalSquare; + } else { + // Piece movement + notation = + piece.toUpperCase() + + (move.vanish.length > 1 ? "x" : "") + + finalSquare; } - // Piece movement - return ( - piece.toUpperCase() + - (move.vanish.length > 1 ? "x" : "") + - finalSquare + - (move.vanish.length > 1 ? "=" + move.appear[0].p.toUpperCase() : "") - ); + if (move.appear[0].p != move.vanish[0].p) + notation += "=" + move.appear[0].p.toUpperCase(); + return notation; } }; diff --git a/client/src/variants/Extinction.js b/client/src/variants/Extinction.js index 59620f95..8c970682 100644 --- a/client/src/variants/Extinction.js +++ b/client/src/variants/Extinction.js @@ -24,8 +24,6 @@ export class ExtinctionRules extends ChessRules { return true; } - scanKings() {} - setOtherVariables(fen) { super.setOtherVariables(fen); const pos = V.ParseFen(fen).position; diff --git a/client/src/variants/Losers.js b/client/src/variants/Losers.js index b39d24fb..daabbab4 100644 --- a/client/src/variants/Losers.js +++ b/client/src/variants/Losers.js @@ -5,7 +5,7 @@ import { randInt } from "@/utils/alea"; export class LosersRules extends ChessRules { // Trim all non-capturing moves static KeepCaptures(moves) { - return moves.filter(m => m.vanish.length == 2); + return moves.filter(m => m.vanish.length == 2 && m.appear.length == 1); } // Stop at the first capture found (if any) @@ -18,7 +18,7 @@ export class LosersRules extends ChessRules { this.board[i][j] != V.EMPTY && this.getColor(i, j) != oppCol && this.getPotentialMovesFrom([i, j]).some(m => - // Warning: duscard castle moves + // Warning: discard castle moves m.vanish.length == 2 && m.appear.length == 1) ) { return true; -- 2.44.0