From: Benjamin Auder Date: Sat, 17 Apr 2021 12:14:22 +0000 (+0200) Subject: Fix Football, add some pieces movements in rules for Cwda X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/images/assets/current/img/%3C?a=commitdiff_plain;h=5c27a4b518693204ee33f85b50cb2cd518d38941;p=vchess.git Fix Football, add some pieces movements in rules for Cwda --- diff --git a/client/src/translations/rules/Cwda/en.pug b/client/src/translations/rules/Cwda/en.pug index 30c016d2..af8b8163 100644 --- a/client/src/translations/rules/Cwda/en.pug +++ b/client/src/translations/rules/Cwda/en.pug @@ -39,6 +39,12 @@ figure.diagram-container figcaption. Moves of the Bede on the left, and of the Waffle on the right. +figure.diagram-container + .diagram + | fen:8/8/8/3F4/8/8/8/8 b7,c6,b5,f5,d3,d7,b3,c4,e4,f3,e6,f7: + figcaption. + Moves of the Fad. + p. When castling large, the king and rook arrive respectively on b1/b8 and c1/c8 so that the rook remains on the same color. @@ -61,11 +67,19 @@ ul figure.diagram-container .diagram.diag12 - | fen:8/8/8/3i4/8/8/8/8 c7,c3,e7,e3,c4,c6,e6,e4: + | fen:8/8/8/8/3G4/8/8/8 d5,d6,d7,d8,c4,b4,a4,e4,f4,g4,h4,c3,d3,e3: + .diagram.diag22 + | fen:8/8/8/8/4i3/8/8/8 d6,d2,f6,f2,d3,d5,f5,f3: + figcaption. + Moves of the Charging rook on the left, and of the Fibnif on the right. + +figure.diagram-container + .diagram.diag12 + | fen:8/8/8/8/3T4/8/8/8 b5,c6,e6,f5,c4,e4,c3,d3,e3: .diagram.diag22 - | fen:8/8/8/4T3/8/8/8/8 c6,d7,f7,g6,d5,f5,d4,e4,f4: + | fen:8/8/8/8/4c3/8/8/8 e5,e6,e7,e8,d4,c4,b4,a4,f4,g4,h4,d6,c5,f6,g5,d5,f5,d3,e3,f3: figcaption. - Moves of the Fibnif on the left, and of the Charging knight on the right. + Moves of the Charging knight on the left, and of the Colonel on the right. h3 The Remarkable Rookies diff --git a/client/src/translations/rules/Cwda/es.pug b/client/src/translations/rules/Cwda/es.pug index a5b5ac85..727ee165 100644 --- a/client/src/translations/rules/Cwda/es.pug +++ b/client/src/translations/rules/Cwda/es.pug @@ -41,6 +41,12 @@ figure.diagram-container | fen:8/8/8/4w3/8/8/8/8 e6,f5,e4,d5,c7,g7,g3,c3: figcaption Jugadas del Bede a la izquierda y del Gofre a la derecha. +figure.diagram-container + .diagram + | fen:8/8/8/3F4/8/8/8/8 b7,c6,b5,f5,d3,d7,b3,c4,e4,f3,e6,f7: + figcaption. + Jugadas del Fad. + p. Después del gran enroque, el rey y la torre llegan respectivamente en b1/b8 y c1/c8 para que la torre permanezca al mismo color. @@ -67,11 +73,19 @@ ul figure.diagram-container .diagram.diag12 - | fen:8/8/8/3i4/8/8/8/8 c7,c3,e7,e3,c4,c6,e6,e4: + | fen:8/8/8/8/3G4/8/8/8 d5,d6,d7,d8,c4,b4,a4,e4,f4,g4,h4,c3,d3,e3: + .diagram.diag22 + | fen:8/8/8/8/4i3/8/8/8 d6,d2,f6,f2,d3,d5,f5,f3: + figcaption. + Jugadas de la Torre de carga a la izquierda, y del Fibnif a la derecha. + +figure.diagram-container + .diagram.diag12 + | fen:8/8/8/8/3T4/8/8/8 b5,c6,e6,f5,c4,e4,c3,d3,e3: .diagram.diag22 - | fen:8/8/8/4T3/8/8/8/8 c6,d7,f7,g6,d5,f5,d4,e4,f4: + | fen:8/8/8/8/4c3/8/8/8 e5,e6,e7,e8,d4,c4,b4,a4,f4,g4,h4,d6,c5,f6,g5,d5,f5,d3,e3,f3: figcaption. - Jugadas del Fibnif a la izquierda, y del Caballo de carga a la derecha. + Jugadas del Caballo de carga a la izquierda, y del Coronel a la derecha. h3 Las Reclutas Notables diff --git a/client/src/translations/rules/Cwda/fr.pug b/client/src/translations/rules/Cwda/fr.pug index 53e51d8d..a5c7ce21 100644 --- a/client/src/translations/rules/Cwda/fr.pug +++ b/client/src/translations/rules/Cwda/fr.pug @@ -41,6 +41,12 @@ figure.diagram-container | fen:8/8/8/4w3/8/8/8/8 e6,f5,e4,d5,c7,g7,g3,c3: figcaption Coups du Bede à gauche, et de la Gaufre à droite. +figure.diagram-container + .diagram + | fen:8/8/8/3F4/8/8/8/8 b7,c6,b5,f5,d3,d7,b3,c4,e4,f3,e6,f7: + figcaption. + Coups du Fad. + p. Après le grand roque, roi et tour arrivent respectivement en b1/b8 et c1/c8 afin que la tour reste sur la même couleur. @@ -67,10 +73,17 @@ ul figure.diagram-container .diagram.diag12 - | fen:8/8/8/3i4/8/8/8/8 c7,c3,e7,e3,c4,c6,e6,e4: + | fen:8/8/8/8/3G4/8/8/8 d5,d6,d7,d8,c4,b4,a4,e4,f4,g4,h4,c3,d3,e3: + .diagram.diag22 + | fen:8/8/8/8/4i3/8/8/8 d6,d2,f6,f2,d3,d5,f5,f3: + figcaption Coups de la Tour chargeante à gauche, et du Fibnif à droite. + +figure.diagram-container + .diagram.diag12 + | fen:8/8/8/8/3T4/8/8/8 b5,c6,e6,f5,c4,e4,c3,d3,e3: .diagram.diag22 - | fen:8/8/8/4T3/8/8/8/8 c6,d7,f7,g6,d5,f5,d4,e4,f4: - figcaption Coups du Fibnif à gauche, et du Cavalier chargeant à droite. + | fen:8/8/8/8/4c3/8/8/8 e5,e6,e7,e8,d4,c4,b4,a4,f4,g4,h4,d6,c5,f6,g5,d5,f5,d3,e3,f3: + figcaption Coups du Cavalier chargeant à gauche, et du Colonel à droite. h3 Les Recrues Remarquables diff --git a/client/src/variants/Football.js b/client/src/variants/Football.js index 7829c2d6..18a3ecad 100644 --- a/client/src/variants/Football.js +++ b/client/src/variants/Football.js @@ -159,7 +159,7 @@ export class FootballRules extends ChessRules { V.OnBoard(i, j) && this.board[i][j] == V.EMPTY && ( - // In a corner? The, allow all ball moves + // In a corner? Then, allow all ball moves ([0, 8].includes(bp[0]) && [0, 8].includes(bp[1])) || // Do not end near the knight (Math.abs(i - x) >= 2 || Math.abs(j - y) >= 2) @@ -246,34 +246,17 @@ export class FootballRules extends ChessRules { const moves = super.getPotentialMovesFrom([x, y]) .filter(m => m.end.y != 4 || ![0, 8].includes(m.end.x)); // If bishop stuck in a corner: allow to jump over the next obstacle - if (moves.length == 0 && piece == V.BISHOP) { - if ( - x == 0 && y == 0 && - this.board[1][1] != V.EMPTY && - this.board[2][2] == V.EMPTY - ) { - return [super.getBasicMove([x, y], [2, 2])]; - } - if ( - x == 0 && y == 8 && - this.board[1][7] != V.EMPTY && - this.board[2][6] == V.EMPTY - ) { - return [super.getBasicMove([x, y], [2, 6])]; - } - if ( - x == 8 && y == 0 && - this.board[7][1] != V.EMPTY && - this.board[6][2] == V.EMPTY - ) { - return [super.getBasicMove([x, y], [6, 2])]; - } + if ( + moves.length == 0 && piece == V.BISHOP && + [0, 8].includes(x) && [0, 8].includes(y) + ) { + const indX = x == 0 ? [1, 2] : [7, 6]; + const indY = y == 0 ? [1, 2] : [7, 6]; if ( - x == 8 && y == 8 && - this.board[7][7] != V.EMPTY && - this.board[6][6] == V.EMPTY + this.board[indX[0]][indY[0]] != V.EMPTY && + this.board[indX[1]][indY[1]] == V.EMPTY ) { - return [super.getBasicMove([x, y], [6, 6])]; + return [super.getBasicMove([x, y], [indX[1], indY[1]])]; } } return moves; @@ -293,9 +276,9 @@ export class FootballRules extends ChessRules { const kmoves = this.tryKickFrom([i, j]); kmoves.forEach(km => { const key = V.CoordsToSquare(km.start) + V.CoordsToSquare(km.end); - if (!kicks[km]) { + if (!kicks[key]) { moves.push(km); - kicks[km] = true; + kicks[key] = true; } }); } @@ -306,7 +289,7 @@ export class FootballRules extends ChessRules { for (let j=0; j < V.size.y; j++) { if (this.board[i][j] != V.EMPTY && this.getColor(i, j) == c) { moves.push(super.getBasicMove([x, y], [i, j])); - if (!!computer) break outerLoop; + if (computer) break outerLoop; } } }