From: Benjamin Auder Date: Thu, 11 Jun 2020 19:52:14 +0000 (+0200) Subject: Fix Pawnmassacre X-Git-Url: https://git.auder.net/app_dev.php/bundles/doc/html/rpsls.js?a=commitdiff_plain;h=cfa37af093bf8b8311b8fff5f79697308dc2bc07;p=vchess.git Fix Pawnmassacre --- diff --git a/TODO b/TODO index 9a8c2e3a..9f46a8ea 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ +r5k1/1R5p/3N4/4pP2/1p4P1/2p5/1rP1PKP1/8 w - - 0 1 + Simultaneous games: view Game + Simultaneous, using component (One)Game Storage: just key ID => IDs of actual games (in indexedDB) In Hall challenge: acceptation on sender side (who launch the game when ready --> left click [which just delete if nobody registered, with confirm box]) diff --git a/client/src/variants/Pawnmassacre.js b/client/src/variants/Pawnmassacre.js index 563fd00b..45756bce 100644 --- a/client/src/variants/Pawnmassacre.js +++ b/client/src/variants/Pawnmassacre.js @@ -6,13 +6,18 @@ export class PawnmassacreRules extends ChessRules { } static GenRandInitFen(randomness) { - return ( - ChessRules.GenRandIntFen(randomness) + const bFen = + ChessRules.GenRandInitFen(randomness) // Remove castle flags - .slice(0, -6).concat("-") + .slice(0, -6).concat("-"); + const splitIdx = bFen.indexOf(' '); + return ( + bFen.substr(0, splitIdx) .replace("PPPPPPPP", "pppppppp") // Next replacement is OK because only acts on first occurrence .replace("pppppppp", "PPPPPPPP") + .split("").reverse().join("") + .concat(bFen.substr(splitIdx)) ); } };