From: Benjamin Auder Date: Wed, 1 Apr 2020 00:11:24 +0000 (+0200) Subject: Fix and describe Maxima rules X-Git-Url: https://git.auder.net/variants/Chakart/doc/scripts/img/pieces/%24%7BgetWhatsApp%28link%29%7D?a=commitdiff_plain;h=38408f63ba218298876fe42934516ebe63e3caba;p=vchess.git Fix and describe Maxima rules --- diff --git a/client/src/translations/rules/Maxima/en.pug b/client/src/translations/rules/Maxima/en.pug index c1a22b1d..7649d4a6 100644 --- a/client/src/translations/rules/Maxima/en.pug +++ b/client/src/translations/rules/Maxima/en.pug @@ -5,16 +5,74 @@ p.boxed. figure.diagram-container .diagram | fen:xxx2xxx/1g1qk1g1/1bnmrnb1/dppppppd/8/8/8/DPPPPPPD/1BNMRNB1/1G1QK1G1/xxx2xxx: - figcaption Standard deterministic position + figcaption Initial deterministic position + +p + | The pawns, queen, rook, inverted rook and knights are respectively called + | Pincers, Withdrawer, Coordinator, Immobilizer and Long Leapers. They behave + | exactly as in Baroque chess - so I won't describe them here, please read + | the + a(href="/#/variants/Baroque") Baroque rules + | . + +p. + The bishop is a Chameleon, which capture pieces in the way themselves would + capture. Its captures are thus the same as in Baroque chess, with a few + exceptions: it captures the King and the Mage only when standing + on an adjacent square. + +h3 New pieces, new movements + +p + | The inverted queen is a Mage, a powerful piece moving one square + | diagonally, and then potentially several squares orthogonally as the figure + | shows. It captures by replacement. See + a(href="https://www.chessvariants.com/piececlopedia.dir/griffon.html") + | this page + |  for a detailed introduction to this piece. + +figure.diagram-container + .diagram + | fen:xxx2xxx/8/8/8/8/3G4/8/8/8/8/xxx2xxx c7,c8,c9,c10,b7,a7,c5,c4,c3,c2,b5,a5,e5,e4,e3,e2,e1,e7,e8,e9,e10,e11,f7,g7,h7,f5,g5,h5: + figcaption Mage movements. + +p In this game the Mage is the only piece which cannot be immobilized. + +p. + The piece looking like a king without a cross moves and captures like a + regular king, but has no royal status. It is called a Guard in this game. p. - The pawns, queen, rook, inverted rook and knights are respectively called - Pincers, Withdrawer, Coordinator, Immobilizer and Long Leapers, and behave - exactly as in Baroque chess - so I won't describe them here, please read the - Baroque rules. + Finally, the king moves like an orthodox knight with an extra ability: + he evolves on a cylindrical board. That means he can potentially move to the + columns 'a' or 'b' from the columns 'g' or 'h' (and vice versa). + He also capture by replacement. + +figure.diagram-container + .diagram + | fen:xxx2xxx/8/8/8/8/K7/8/8/8/8/xxx2xxx b4,b8,c5,c7,g5,g7,h4,h8: + figcaption King movements. +h3 End of the game + +p. + A stalemate is a draw, and a checkmate wins. + There are two other options to win a game: +ul + li. + Occupy both squares "of the enemy palace" (the two squares of the last + rank), or + li Capture all opponent' pieces (except the king). p. + You can have one piece in your own palace, but it's forbidden to fully + occupy it. - guard mage king +h3 Source +p + | The + a(href="https://www.chessvariants.com/dpieces.dir/maxima/maxima.html") + | Maxima variant + |  on chessvariants.com. +p Inventor: Roberto Lavieri (2003) diff --git a/client/src/translations/rules/Maxima/es.pug b/client/src/translations/rules/Maxima/es.pug index 1333ed77..9b951d42 100644 --- a/client/src/translations/rules/Maxima/es.pug +++ b/client/src/translations/rules/Maxima/es.pug @@ -1 +1,79 @@ -TODO +p.boxed. + Los movimientos y las capturas de las piezas son complejos. + Puedes ganar ocupando los dos cuadros en la última fila. + +figure.diagram-container + .diagram + | fen:xxx2xxx/1g1qk1g1/1bnmrnb1/dppppppd/8/8/8/DPPPPPPPD/1BNMRNB1/1G1QK1G1/xxx2xxx: + figcaption Posición determinista inicial + +p + | Los peones, la reina, la torre, la torre invertida y los caballos son + | respectivamente llama Pinchazos, Supresor, Coordinador, Inmovilizador y + | Saltadores Largos. Se comportan exactamente como el ajedrez Barroco + | - que no describiré aquí, por favor consulte las + a(href="/#/variantes/Baroque") reglas Barrocas + | . + +p. + El alfil es un camaleón, que captura las piezas en la forma en que + habría capturado. Sus capturas son, por lo tanto, las mismas que en el + ajedrez Barroco, con algunas excepciones: solo capturó al Mago y al Rey + desde una casilla adyacente + +h3 Nuevas piezas, nuevos movimientos + +p + | La dama invertida es un Mago, una pieza poderosa que se mueve primero + | una caja en diagonal, luego potencialmente varias casillas + | ortogonalmente como se muestra en la figura. + | Captura por reemplazo. Ver + a(href="https://www.chessvariants.com/piececlopedia.dir/griffon.html") + | esta página + |  para una introducción detallada a esta pieza. + +figure.diagram-container + .diagram + | fen:xxx2xxx/8/8/8/8/3G4/8/8/8/8/xxx2xxx c7,c8,c9,c10,b7,a7,c5,c4,c3,c2,b5,a5,e5,e4,e3,e2,e1,e7,e8,e9,e10,e11,f7,g7,h7,f5,g5,h5: + figcaption Movimientos del Mago. + +p En este juego, el Mago es la única pieza que no puede ser inmovilizada. + +p. + La pieza que se parece a un rey sin cruz se mueve y captura como un rey + usual, pero no tiene estatus real. Se llama "Guardia" aquí. + +p. + Finalmente, el rey se mueve como un caballo ortodoxo con una condición + adicional: evoluciona en un tablero de ajedrez cilíndrico. Eso significa que + potencialmente puede llegar a la columna 'a' o 'b' de las columnas + 'g' o 'h' (y vice-versa). También captura por reemplazo. + +figure.diagram-container + .diagram + | fen:xxx2xxx/8/8/8/8/K7/8/8/8/8/xxx2xxx b4,b8,c5,c7,g5,g7,h4,h8: + figcaption Movimientos del rey. + +h3 Fin de la partida + +p. + Un empate hace tablas, y un jaque mate gana. + Hay otras dos opciones para ganar una partida: +ul + li. + Ocupa las dos casillas del "palacio real enemigo" (las dos cajas del + última fila), o + li Captura todas las piezas opuestas, excepto el rey. +p. + Es posible tener una pieza en su propio palacio, pero está prohibido + ocuparlo totalmente. + +h3 Fuente + +p + | La + a(href="https://www.chessvariants.com/dpieces.dir/maxima/maxima.html") + | variante Maxima + |  en chessvariants.com. + +p Inventor: Roberto Lavieri (2003) diff --git a/client/src/translations/rules/Maxima/fr.pug b/client/src/translations/rules/Maxima/fr.pug index 1333ed77..b34eb700 100644 --- a/client/src/translations/rules/Maxima/fr.pug +++ b/client/src/translations/rules/Maxima/fr.pug @@ -1 +1,79 @@ -TODO +p.boxed. + Les déplacements des pièces et les captures sont complexes. + Vous pouvez gagner en occupant les deux cases de la dernière rangée. + +figure.diagram-container + .diagram + | fen:xxx2xxx/1g1qk1g1/1bnmrnb1/dppppppd/8/8/8/DPPPPPPD/1BNMRNB1/1G1QK1G1/xxx2xxx: + figcaption Position initiale déterministe + +p + | Les pions, la dame, la tour, la tour inversée et les cavaliers sont + | respectivement appels Pinceurs, Retireur, Coordinateur, Immobiliseur et + | Sauteurs Longs. Elles se comportent exactement comme aux échecs Baroques + | - dont je ne les décrirai pas ici, référez-vous svp aux + a(href="/#/variants/Baroque") règles Baroques + | . + +p. + Le fou est un caméléon, qui capture les pièces de la manières dont elles + auraient capturé. Ses captures sont donc les mêmes qu'aux échecs Baroques, + avec quelques exceptions : il capture le Mage et le Roi seulement depuis + une case adjacente. + +h3 Nouvelles pièces, nouveaux mouvements + +p + | La dame inversée est un Mage, une pièce puissante se déplaçant d'abord + | d'une case en diagonale, puis potentiellement de plusieurs cases + | orthogonalement comme le montre la figure. + | Il capture par remplacement. Voir + a(href="https://www.chessvariants.com/piececlopedia.dir/griffon.html") + | cette page + |  pour une introduction détaillée à cette pièce. + +figure.diagram-container + .diagram + | fen:xxx2xxx/8/8/8/8/3G4/8/8/8/8/xxx2xxx c7,c8,c9,c10,b7,a7,c5,c4,c3,c2,b5,a5,e5,e4,e3,e2,e1,e7,e8,e9,e10,e11,f7,g7,h7,f5,g5,h5: + figcaption Mage movements. + +p Dans ce jeu le Mage est la seule pièce qui ne peut pas être immobilisée. + +p. + La pièce ressemblant à un roi sans croix se déplace et capture comme un roi + habituel, mais n'a aucun statut royal. Il est appelé "Garde" ici. + +p. + Enfin, le roi se déplace comme un cavalier orthodoxe avec une condition + supplémentaire : il évolue sur un échiquier cylindrique. Cela signifie qu'il + peut potentiellement arriver sur la colonne 'a' ou 'b' depuis les colonnes + 'g' ou 'h' (et vice-versa). Il capture aussi par remplacement. + +figure.diagram-container + .diagram + | fen:xxx2xxx/8/8/8/8/K7/8/8/8/8/xxx2xxx b4,b8,c5,c7,g5,g7,h4,h8: + figcaption Mouvements du roi. + +h3 Fin de la partie + +p. + Un pat fait nulle, et un échec et mat gagne. + Il y a deux autres options pour gagner une partie : +ul + li. + Occuper les deux cases du "palais royal ennemi" (les deux cases de la + dernière rangée), ou + li Capturer toutes les pièces adverses - à l'exception du roi. +p. + Il est possible d'avoir une pièce dans son propre palais, mais interdit de + l'occuper totalement. + +h3 Source + +p + | La + a(href="https://www.chessvariants.com/dpieces.dir/maxima/maxima.html") + | variante Maxima + |  sur chessvariants.com. + +p Inventeur : Roberto Lavieri (2003) diff --git a/client/src/variants/Maxima.js b/client/src/variants/Maxima.js index ab97a217..83d20765 100644 --- a/client/src/variants/Maxima.js +++ b/client/src/variants/Maxima.js @@ -177,11 +177,11 @@ export class MaximaRules extends ChessRules { return moves; // Filter out moves resulting in self palace occupation: // NOTE: cannot invade own palace but still check the king there. - const pY = (this.board[pX][3] == V.EMPTY ? 4 : 3); + const pY = (this.board[pX][3] != V.EMPTY ? 4 : 3); return moves.filter(m => m.end.x != pX || m.end.y != pY); } - getSlideNJumpMoves([x, y], steps, oneStep, mageInitSquare, onlyTake) { + getSlideNJumpMoves([x, y], steps, oneStep, mageInitSquare) { const piece = !mageInitSquare ? this.getPiece(x, y) : V.MAGE; const initSquare = mageInitSquare || [x, y]; let moves = []; @@ -190,21 +190,16 @@ export class MaximaRules extends ChessRules { let j = y + step[1]; if (piece == V.KING) j = j % V.size.y; while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) { - if (!onlyTake) moves.push(this.getBasicMove(initSquare, [i, j])); + moves.push(this.getBasicMove(initSquare, [i, j])); if (!!oneStep) continue outerLoop; i += step[0]; j += step[1]; } - // Only king, guard and mage + chameleon can take on occupied square: + // Only king, guard and mage (+ chameleon) can take on occupied square: if ( - V.OnBoard(i, j) - && + V.OnBoard(i, j) && + [V.KING, V.GUARD, V.MAGE].includes(piece) && this.canTake(initSquare, [i, j]) - && - ( - [V.KING, V.GUARD, V.MAGE].includes(piece) || - (piece == V.BISHOP && this.getPiece(i, j) === onlyTake) - ) ) { moves.push(this.getBasicMove(initSquare, [i, j])); } @@ -366,12 +361,22 @@ export class MaximaRules extends ChessRules { let moves = super .getPotentialQueenMoves([x, y]) .concat(this.getKnightCaptures([x, y], "asChameleon")) - .concat(this.getPotentialGuardMoves([x, y], "asChameleon")) - .concat(this.getPotentialMageMoves([x, y], "asChameleon")); // No "king capture" because king cannot remain under check this.addPawnCaptures(moves, "asChameleon"); this.addRookCaptures(moves, "asChameleon"); this.addQueenCaptures(moves, "asChameleon"); + // Manually add Guard and Mage captures (since cannot move like a Mage) + V.steps[V.ROOK].concat(V.steps[V.BISHOP]).forEach(step => { + const [i, j] = [x + step[0], y + step[1]]; + if ( + V.OnBoard(i, j) && + this.board[i][j] != V.EMPTY && + this.canTake([x, y], [i, j]) && + [V.GUARD, V.MAGE].includes(this.getPiece(i, j)) + ) { + moves.push(this.getBasicMove([x, y], [i, j])); + } + }); // Post-processing: merge similar moves, concatenating vanish arrays let mergedMoves = {}; moves.forEach(m => { @@ -443,15 +448,13 @@ export class MaximaRules extends ChessRules { return this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep"); } - getPotentialGuardMoves(sq, byChameleon) { - const onlyTake = !byChameleon ? null : V.GUARD; + getPotentialGuardMoves(sq) { return ( this.getSlideNJumpMoves( sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]), "oneStep", - null, - onlyTake + null ) ); } @@ -465,29 +468,24 @@ export class MaximaRules extends ChessRules { return [[1, 0], [0, 1]]; } - getPotentialMageMoves([x, y], byChameleon) { + getPotentialMageMoves([x, y]) { const oppCol = V.GetOppCol(this.turn); - const onlyTake = !byChameleon ? null : V.MAGE; let moves = []; for (let step of V.steps[V.BISHOP]) { let [i, j] = [x + step[0], y + step[1]]; if (!V.OnBoard(i, j)) continue; if (this.board[i][j] != V.EMPTY) { - if ( - this.getColor(i, j) == oppCol && - (!onlyTake || this.getPiece(i, j) == V.MAGE) - ) { + if (this.getColor(i, j) == oppCol) // Capture moves.push(this.getBasicMove([x, y], [i, j])); - } } else { - if (!onlyTake) moves.push(this.getBasicMove([x, y], [i, j])); + moves.push(this.getBasicMove([x, y], [i, j])); // Continue orthogonally: const stepO = this.getNextMageSteps(step); Array.prototype.push.apply( moves, - this.getSlideNJumpMoves([i, j], stepO, null, [x, y], onlyTake) + this.getSlideNJumpMoves([i, j], stepO, null, [x, y]) ); } }