- static GenRandInitFen() {
- let pieces = { w: new Array(10), b: new Array(10) };
- for (let c of ["w", "b"]) {
- let positions = ArrayFun.range(8);
-
- // Get random squares for grasshoppers (unconstrained)
- let randIndex = randInt(8);
- const grasshopper1Pos = positions[randIndex];
- positions.splice(randIndex, 1);
- randIndex = randInt(7);
- const grasshopper2Pos = positions[randIndex];
- positions.splice(randIndex, 1);
-
- // Knights
- randIndex = randInt(6);
- let knight1Pos = positions[randIndex];
- positions.splice(randIndex, 1);
- randIndex = randInt(5);
- let knight2Pos = positions[randIndex];
- positions.splice(randIndex, 1);
-
- // Queen
- randIndex = randInt(4);
- let queenPos = positions[randIndex];
- positions.splice(randIndex, 1);
-
- let rook1Pos = positions[0];
- let kingPos = positions[1];
- let rook2Pos = positions[2];