Check if the position of the ship is valid