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