From: Benjamin Auder Date: Sun, 28 Mar 2021 09:27:22 +0000 (+0200) Subject: More balanced Shinobi according to Couch Tomato + Fables tests X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/images/css/doc/current/git-logo.png?a=commitdiff_plain;h=b0116a67818668f55cd2a3b3a323b2c91b5bc332;p=vchess.git More balanced Shinobi according to Couch Tomato + Fables tests --- diff --git a/TODO b/TODO index 1ab50465..b13d9b59 100644 --- a/TODO +++ b/TODO @@ -9,3 +9,6 @@ Or, with other board shapes (see greenchess.net for example) Would be nice to display some better variants names (Pacosako -> Paco-Ŝako etc), but the "formatted" name with uppercase + all lower cases would still be required. (For example in variants list, or tournament variant field). + +Chessplode +Tablut diff --git a/client/public/images/pieces/Shinobi/wd.svg b/client/public/images/pieces/Shinobi/wd.svg new file mode 100644 index 00000000..0e1f9ce9 --- /dev/null +++ b/client/public/images/pieces/Shinobi/wd.svg @@ -0,0 +1,207 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/public/images/pieces/Shinobi/ws.svg b/client/public/images/pieces/Shinobi/ws.svg deleted file mode 100644 index 93ed344d..00000000 --- a/client/public/images/pieces/Shinobi/ws.svg +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/client/src/translations/rules/Shinobi/en.pug b/client/src/translations/rules/Shinobi/en.pug index eac9a6f2..0b55d722 100644 --- a/client/src/translations/rules/Shinobi/en.pug +++ b/client/src/translations/rules/Shinobi/en.pug @@ -27,10 +27,10 @@ p h3 New pieces p. - There are five new units unique to the Clan: Ninja, Samurai, Lances, + There are five new units unique to the Clan: Ninja, Dragon, Lance, (Wooden) Horses, and Monks. Captains are a new piece available to both sides, but only the Clan starts with one on the board. - Ninja, Samurai, and Captains do not promote (see below). + Ninja, Dragon, and Captains do not promote (see below). p. The Clan's king is called a Kage (K) and has a different symbol, but the @@ -39,8 +39,8 @@ p. ul li Captain (C) – Moves like a King. Pawns promote to a Captain. li Ninja (J) = Knight + Bishop. - li Samurai (S) = Knight + Rook. li Monk (M) – One-step bishop. + li Dragon (D) = Rook + Monk. li. Horse (H) – Moves only forward two squares, and then one square to the side. @@ -54,8 +54,8 @@ p. h3 Promotion p. - Pawns promote into Captains when reaching the 6th rank. - All minor Clan pieces also promote upon reaching the 6th rank (or beyond): + Pawns promote into Captains when reaching the 7th rank. + All minor Clan pieces also promote upon reaching the two last ranks: ul li Monk into Bishop. li Horse into Knight. diff --git a/client/src/translations/rules/Shinobi/es.pug b/client/src/translations/rules/Shinobi/es.pug index e3d66696..e15dcd1a 100644 --- a/client/src/translations/rules/Shinobi/es.pug +++ b/client/src/translations/rules/Shinobi/es.pug @@ -28,10 +28,10 @@ p h3 Piezas nuevas p. - Cinco nuevas unidades son exclusivas del Clan: Ninja, Samurai, Lances, + Cinco nuevas unidades son exclusivas del Clan: Ninja, Dragón, Lanza, Jamelgos y Monjes. Los Capitanes son una nueva pieza disponible en ambos lados, pero solo el Clan comienza con uno en el tablero. - Los Ninja, Samuráis y Capitanes no son promovidos (ver más abajo). + Los Ninja, Dragón y Capitanes no son promovidos (ver más abajo). p. El rey del Clan se llama Kage (K) y tiene un símbolo diferente, pero el @@ -40,8 +40,8 @@ p. ul li Capitán (C) – Muévese como un rey. Los peones ascienden a Capitán. li Ninja (J) = Caballo + Alfil. - li Samurái (S) = Caballo + Torre. li Monje (M) – Alfil limitado a una casilla. + li Dragón (D) = Torre + Monje. li Jamelgo (H) – Avanza dos espacios, luego una casilla al costado. li. Lanza (L) – Se mueve hacia adelante, @@ -55,9 +55,9 @@ p. h3 Promoción p. - Los peones son promovidos a Capitanes cuando alcanzan la sexta fila. + Los peones son promovidos a Capitanes cuando alcanzan la séptima fila. Todas las piezas menores del Clan también se promocionan una vez en - la sexta fila (o más): + las dos ultimas filas: ul li Monje → Alfil. li Jamelgo → Caballo. diff --git a/client/src/translations/rules/Shinobi/fr.pug b/client/src/translations/rules/Shinobi/fr.pug index d1ba9506..ae6a9db4 100644 --- a/client/src/translations/rules/Shinobi/fr.pug +++ b/client/src/translations/rules/Shinobi/fr.pug @@ -28,10 +28,10 @@ p h3 Nouvelles pièces p. - Cinq nouvelles unités sont uniques au Clan : les Ninja, Samurai, Lances, + Cinq nouvelles unités sont uniques au Clan : les Ninja, Dragon, Lance, Chevaux (de Bois), et Moines. Les Capitaines sont une nouvelle pièce disponible des deux côtés, mais seul le Clan démarre avec un sur l'échiquier. - Les Ninja, Samourai et Capitaines ne sont pas promus (voir ci-dessous). + Les Ninja, Dragon et Capitaines ne sont pas promus (voir ci-dessous). p. Le roi du Clan est appelé Kage (K), et a un symbole différent, mais le @@ -43,8 +43,8 @@ ul Capitaine (C) – Se déplace comme un Roi. Les pions se promeuvent en Capitaine. li Ninja (J) = Cavalier + Fou. - li Samurai (S) = Cavalier + Tour. li Moine (M) – Fou limité à une case. + li Dragon (D) = Tour + Moine. li. Cheval (H) – Se déplace vers l'avant de deux cases, puis d'une case sur le coté. @@ -60,9 +60,9 @@ p. h3 Promotion p. - Les pions sont promus en Capitaines quand ils atteignent la 6eme rangée. + Les pions sont promus en Capitaines quand ils atteignent la 7eme rangée. Toutes les pièces mineures du Clan se promeuvent également une fois sur - la 6eme rangée (ou plus loin) : + les deux dernières rangées : ul li Moine → Fou. li Cheval → Cavalier. diff --git a/client/src/variants/Shinobi.js b/client/src/variants/Shinobi.js index faa4cd7e..dbce82c8 100644 --- a/client/src/variants/Shinobi.js +++ b/client/src/variants/Shinobi.js @@ -12,8 +12,8 @@ export class ShinobiRules extends ChessRules { static get NINJA() { return 'j'; } - static get SAMURAI() { - return 's'; + static get DRAGON() { + return 'd'; } static get MONK() { return 'm'; @@ -33,7 +33,7 @@ export class ShinobiRules extends ChessRules { static get PIECES() { return ( ChessRules.PIECES - .concat([V.CAPTAIN, V.NINJA, V.SAMURAI, V.MONK, V.HORSE, V.LANCE]) + .concat([V.CAPTAIN, V.NINJA, V.DRAGON, V.MONK, V.HORSE, V.LANCE]) ); } @@ -60,7 +60,7 @@ export class ShinobiRules extends ChessRules { if (!ChessRules.IsGoodFen(fen)) return false; const fenParsed = V.ParseFen(fen); // 5) Check reserve - if (!fenParsed.reserve || !fenParsed.reserve.match(/^[0-9]{5,5}$/)) + if (!fenParsed.reserve || !fenParsed.reserve.match(/^[0-2]{6,6}$/)) return false; return true; } @@ -73,12 +73,12 @@ export class ShinobiRules extends ChessRules { ); } - // In hand initially: ninja, samurai + 2 x monk, horse, lance. + // In hand initially: ninja, dragon, 2 x (monk, horse), lance, pawn. static GenRandInitFen(randomness) { const baseFen = ChessRules.GenRandInitFen(Math.min(randomness, 1)); return ( baseFen.substr(0, 35) + "3CK3 " + - "w 0 " + baseFen.substr(48, 2) + " - 11222" + "w 0 " + baseFen.substr(48, 2) + " - 112211" ); } @@ -102,10 +102,11 @@ export class ShinobiRules extends ChessRules { this.reserve = { w: { [V.NINJA]: reserve[0], - [V.SAMURAI]: reserve[1], + [V.DRAGON]: reserve[1], [V.MONK]: reserve[2], [V.HORSE]: reserve[3], - [V.LANCE]: reserve[4] + [V.LANCE]: reserve[4], + [V.PAWN]: reserve[5] } }; } @@ -121,7 +122,7 @@ export class ShinobiRules extends ChessRules { } static get RESERVE_PIECES() { - return [V.NINJA, V.SAMURAI, V.MONK, V.HORSE, V.LANCE]; + return [V.NINJA, V.DRAGON, V.MONK, V.HORSE, V.LANCE, V.PAWN]; } getReserveMoves([x, y]) { @@ -176,7 +177,7 @@ export class ShinobiRules extends ChessRules { case V.KING: return this.getPotentialKingMoves(sq); case V.CAPTAIN: return this.getPotentialCaptainMoves(sq); case V.NINJA: return this.getPotentialNinjaMoves(sq); - case V.SAMURAI: return this.getPotentialSamuraiMoves(sq); + case V.DRAGON: return this.getPotentialDragonMoves(sq); } let moves = []; switch (piece) { @@ -194,7 +195,7 @@ export class ShinobiRules extends ChessRules { moves = this.getPotentialLanceMoves(sq); break; } - const promotionZone = (this.turn == 'w' ? [0, 1, 2] : [5, 6, 7]); + const promotionZone = (this.turn == 'w' ? [0, 1] : [7, 6]); const promotedForm = V.MapUnpromoted[piece]; moves.forEach(m => { if (promotionZone.includes(m.end.x)) m.appear[0].p = promotedForm; @@ -224,10 +225,10 @@ export class ShinobiRules extends ChessRules { ); } - getPotentialSamuraiMoves(sq) { + getPotentialDragonMoves(sq) { return ( super.getSlideNJumpMoves(sq, V.steps[V.ROOK]) - .concat(super.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep")) + .concat(super.getSlideNJumpMoves(sq, V.steps[V.BISHOP], "oneStep")) ); } @@ -252,7 +253,7 @@ export class ShinobiRules extends ChessRules { super.isAttackedByPawn(sq, 'w') || this.isAttackedByCaptain(sq, 'w') || this.isAttackedByNinja(sq, 'w') || - this.isAttackedBySamurai(sq, 'w') || + this.isAttackedByDragon(sq, 'w') || this.isAttackedByMonk(sq, 'w') || this.isAttackedByHorse(sq, 'w') || this.isAttackedByLance(sq, 'w') || @@ -277,11 +278,11 @@ export class ShinobiRules extends ChessRules { ); } - isAttackedBySamurai(sq, color) { + isAttackedByDragon(sq, color) { return ( - super.isAttackedBySlideNJump(sq, color, V.SAMURAI, V.steps[V.ROOK]) || + super.isAttackedBySlideNJump(sq, color, V.DRAGON, V.steps[V.ROOK]) || super.isAttackedBySlideNJump( - sq, color, V.SAMURAI, V.steps[V.KNIGHT], "oneStep") + sq, color, V.DRAGON, V.steps[V.BISHOP], "oneStep") ); } @@ -385,7 +386,7 @@ export class ShinobiRules extends ChessRules { { c: 4, j: 7, - s: 8, + d: 7, m: 2, h: 2, l: 2 @@ -406,7 +407,12 @@ export class ShinobiRules extends ChessRules { } getNotation(move) { - if (move.vanish.length > 0) return super.getNotation(move); + if (move.vanish.length > 0) { + let notation = super.getNotation(move); + if (move.vanish[0].p != V.PAWN && move.appear[0].p != move.vanish[0].p) + notation += "=" + move.appear[0].p.toUpperCase(); + return notation; + } // Drop: const piece = move.appear[0].p != V.PAWN ? move.appear[0].p.toUpperCase() : "";