- // TODO: adapt
- static GenRandInitFen(options) {
- const baseFen = ChessRules.GenRandInitFen(options);
- return (
- // Add 16 pawns flags + empty cmove + stage == 1:
- baseFen.slice(0, -2) + "1111111111111111 - - 1" +
- (!options["switch"] ? '-' : "")
- );
- }
- {
- cmove: fenParts[5],
- stage: fenParts[6]
- }
-
- getCmoveFen() {
- const L = this.cmoves.length;
- return (
- !this.cmoves[L - 1]
- ? "-"
- : ChessRules.CoordsToSquare(this.cmoves[L - 1].start) +
- ChessRules.CoordsToSquare(this.cmoves[L - 1].end)
- );
- }
-
- getStageFen() {
- if (this.stage == 1) return "1" + (!this.canSwitch ? '-' : "");
- // Stage == 2:
- return "2" + this.sideCheckered;
- }
-
- getFen() {
- return (
- super.getFen() + " " + this.getCmoveFen() + " " + this.getStageFen()
- );
- }
-
- getFlagsFen() {
- let fen = super.getFlagsFen();
- // Add pawns flags
- for (let c of ["w", "b"])
- for (let i = 0; i < 8; i++) fen += (this.pawnFlags[c][i] ? "1" : "0");
- return fen;
- }
-