+ // Has to be redefined to avoid an infinite loop
+ getAllValidMoves()
+ {
+ const color = this.turn;
+ const oppCol = this.getOppCol(color);
+ let potentialMoves = [];
+ for (let i=0; i<V.size.x; i++)
+ {
+ for (let j=0; j<V.size.y; j++)
+ {
+ if (this.board[i][j] != V.EMPTY && this.getColor(i,j) == color)
+ Array.prototype.push.apply(potentialMoves, this.getPotentialMovesFrom([i,j]));
+ }
+ }
+ return potentialMoves; //because there are no checks
+ }
+