- filterValid(moves) {
- if (moves.length == 0) return [];
- const color = this.turn;
- const oppCol = V.GetOppCol(color);
- return moves.filter(m => {
- this.play(m);
- // Giving check is forbidden as well:
- const res = !this.underCheck(color) && !this.underCheck(oppCol);
- this.undo(m);
- return res;
- });