Fix moving through blocked squares

Fix getLegalMoves() in both King and Rook classes to avoid trying to
move into or beyond blocked squares. This also fixes the White rook
capturing the Black king, which is not legal.