Fix Pawnmassacre
[vchess.git] / client / src / variants / Pawnmassacre.js
CommitLineData
737a5daf
BA
1import { ChessRules } from "@/base_rules";
2
3export class PawnmassacreRules extends ChessRules {
4 static get HasFlags() {
5 return false;
6 }
7
8 static GenRandInitFen(randomness) {
cfa37af0
BA
9 const bFen =
10 ChessRules.GenRandInitFen(randomness)
737a5daf 11 // Remove castle flags
cfa37af0
BA
12 .slice(0, -6).concat("-");
13 const splitIdx = bFen.indexOf(' ');
14 return (
15 bFen.substr(0, splitIdx)
737a5daf
BA
16 .replace("PPPPPPPP", "pppppppp")
17 // Next replacement is OK because only acts on first occurrence
18 .replace("pppppppp", "PPPPPPPP")
cfa37af0
BA
19 .split("").reverse().join("")
20 .concat(bFen.substr(splitIdx))
737a5daf
BA
21 );
22 }
23};