import { randInt } from "@/utils/alea";
export class LosersRules extends ChessRules {
+
// Trim all non-capturing moves
static KeepCaptures(moves) {
return moves.filter(m => m.vanish.length == 2 && m.appear.length == 1);
getPossibleMovesFrom(sq) {
let moves = this.filterValid(this.getPotentialMovesFrom(sq));
const captureMoves = V.KeepCaptures(moves);
-
-console.log(this.atLeastOneCapture());
-
if (captureMoves.length > 0) return captureMoves;
if (this.atLeastOneCapture()) return [];
return moves;
// Less material is better (more subtle in fact but...)
return -super.evalPosition();
}
+
};