Fixed check and checkmate not working. Improved getAllValidMoves to take an extra argument, so that it will get only white/black moves.