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