- pieces[c][rook1Pos] = 'r';
- pieces[c][knight1Pos] = 'n';
- pieces[c][bishop1Pos] = 'b';
- pieces[c][queenPos] = 'q';
- pieces[c][kingPos] = 'k';
- pieces[c][bishop2Pos] = 'b';
- pieces[c][knight2Pos] = 'n';
- pieces[c][rook2Pos] = 'r';
- }
- return pieces["w"].join("").toUpperCase() +
- "/PPPPPPPP/8/8/8/8/pppppppp/" +
- pieces["b"].join("") +
- " w 0"; //no castle, no en-passant
- }
-}
+ randIndex = randInt(3);
+ const queenPos = positions[randIndex];
+ positions.splice(randIndex, 1);
+
+ const rook1Pos = positions[0];
+ const rook2Pos = positions[1];
+
+ pieces[c][rook1Pos] = "r";
+ pieces[c][knight1Pos] = "n";
+ pieces[c][bishop1Pos] = "b";
+ pieces[c][queenPos] = "q";
+ pieces[c][kingPos] = "k";
+ pieces[c][bishop2Pos] = "b";
+ pieces[c][knight2Pos] = "n";
+ pieces[c][rook2Pos] = "r";
+ }
+ return (
+ pieces["w"].join("").toUpperCase() +
+ "/PPPPPPPP/8/8/8/8/pppppppp/" +
+ pieces["b"].join("") +
+ // No castle, no en-passant:
+ " w 0"
+ );
+ }
+
+ static get SEARCH_DEPTH() {
+ return 2;
+ }
+
+};