1 class UpsidedownRules
extends ChessRules
3 static HasFlags() { return false; }
5 // Forbid two knights moves in a row at moves 1 and 2
6 getPotentialKnightMoves(sq
)
8 // But this will also affect FEN for problems, and...
9 // does it really solve the problem ?
10 //if (this.moves. ...)
13 getPotentialKingMoves(sq
)
16 return this.getSlideNJumpMoves(sq
,
17 V
.steps
[V
.ROOK
].concat(V
.steps
[V
.BISHOP
]), "oneStep");
20 static GenRandInitFen()
22 let pieces
= { "w": new Array(8), "b": new Array(8) };
23 for (let c
of ["w","b"])
25 let positions
= _
.range(8);
27 let randIndex
= 2 * _
.random(3);
28 let bishop1Pos
= positions
[randIndex
];
29 let randIndex_tmp
= 2 * _
.random(3) + 1;
30 let bishop2Pos
= positions
[randIndex_tmp
];
31 positions
.splice(Math
.max(randIndex
,randIndex_tmp
), 1);
32 positions
.splice(Math
.min(randIndex
,randIndex_tmp
), 1);
34 randIndex
= _
.random(5);
35 let knight1Pos
= positions
[randIndex
];
36 positions
.splice(randIndex
, 1);
37 randIndex
= _
.random(4);
38 let knight2Pos
= positions
[randIndex
];
39 positions
.splice(randIndex
, 1);
41 randIndex
= _
.random(3);
42 let queenPos
= positions
[randIndex
];
43 positions
.splice(randIndex
, 1);
45 let rook1Pos
= positions
[0];
46 let kingPos
= positions
[1];
47 let rook2Pos
= positions
[2];
49 pieces
[c
][rook1Pos
] = 'r';
50 pieces
[c
][knight1Pos
] = 'n';
51 pieces
[c
][bishop1Pos
] = 'b';
52 pieces
[c
][queenPos
] = 'q';
53 pieces
[c
][kingPos
] = 'k';
54 pieces
[c
][bishop2Pos
] = 'b';
55 pieces
[c
][knight2Pos
] = 'n';
56 pieces
[c
][rook2Pos
] = 'r';
58 return pieces
["w"].join("").toUpperCase() +
59 "/PPPPPPPP/8/8/8/8/pppppppp/" +
60 pieces
["b"].join("") +
61 " w 1111 -"; //add turn + flags + enpassant
65 const VariantRules
= UpsidedownRules
;