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