import {Random} from "/utils/alea.js";
-export class FenUtil = {
+export const FenUtil = {
// arg o (constraints): "between" with p1 and p2.
// "flags", "diffCol": array of pieceType
- setupRow(arr, o) {
+ setupRow: function(arr, o) {
let res = JSON.parse(JSON.stringify(arr));
if (o.randomness >= 1)
res = Random.shuffle(arr);
}
}
return {fen: res, flags: flags};
- }
+ },
- setupPieces(arr, o) {
+ setupPieces: function(arr, o) {
const row1 = FenUtil.setupRow(arr, o);
const row2 = o.randomness == 2 ? FenUtil.setupRow(arr, o) : row1;
return {
}
// NOTE: canTake includes (wrong) captures of antiking,
- // to not go to low-level using findDestSquares()
+ // to detect attacks on antikings.
canTake([x1, y1], [x2, y2]) {
const piece1 = this.getPiece(x1, y1);
const color1 = this.getColor(x1, y1);