1 class UpsidedownRules
extends ChessRUles
3 static HasFlags() { return false; }
5 getPotentialKingMoves(sq
)
8 return this.getSlideNJumpMoves(sq
,
9 V
.steps
[V
.ROOK
].concat(V
.steps
[V
.BISHOP
]), "oneStep");
12 static GenRandInitFen()
14 let pieces
= { "w": new Array(8), "b": new Array(8) };
15 for (let c
of ["w","b"])
17 let positions
= _
.range(8);
19 let randIndex
= 2 * _
.random(3);
20 let bishop1Pos
= positions
[randIndex
];
21 let randIndex_tmp
= 2 * _
.random(3) + 1;
22 let bishop2Pos
= positions
[randIndex_tmp
];
23 positions
.splice(Math
.max(randIndex
,randIndex_tmp
), 1);
24 positions
.splice(Math
.min(randIndex
,randIndex_tmp
), 1);
26 randIndex
= _
.random(5);
27 let knight1Pos
= positions
[randIndex
];
28 positions
.splice(randIndex
, 1);
29 randIndex
= _
.random(4);
30 let knight2Pos
= positions
[randIndex
];
31 positions
.splice(randIndex
, 1);
33 randIndex
= _
.random(3);
34 let queenPos
= positions
[randIndex
];
35 positions
.splice(randIndex
, 1);
37 let rook1Pos
= positions
[0];
38 let kingPos
= positions
[1];
39 let rook2Pos
= positions
[2];
41 pieces
[c
][rook1Pos
] = 'r';
42 pieces
[c
][knight1Pos
] = 'n';
43 pieces
[c
][bishop1Pos
] = 'b';
44 pieces
[c
][queenPos
] = 'q';
45 pieces
[c
][kingPos
] = 'k';
46 pieces
[c
][bishop2Pos
] = 'b';
47 pieces
[c
][knight2Pos
] = 'n';
48 pieces
[c
][rook2Pos
] = 'r';
50 return pieces
["w"].join("") +
51 "/PPPPPPPP/8/8/8/8/pppppppp/" +
52 pieces
["b"].join("").toUpperCase() +
53 " w 1111 -"; //add turn + flags + enpassant
57 const VariantRules
= UpsidedownRules
;