+ return moves.filter(m => {
+ if (this.oppositeMoves(this.umoves[L - 1], m)) return false;
+ if (!m.end.released) return true;
+ // Check for repetitions:
+ V.PlayOnBoard(this.board, m);
+ const newState = {
+ piece: m.end.released,
+ square: { x: m.end.x, y: m.end.y },
+ position: this.getBaseFen()
+ };
+ const repet =
+ this.repetitions.some(r => {
+ return (
+ r.piece == newState.piece &&
+ (
+ r.square.x == newState.square.x &&
+ r.square.y == newState.square.y
+ ) &&
+ r.position == newState.position
+ );
+ });
+ V.UndoOnBoard(this.board, m);
+ return !repet;
+ });