Fixed algorithm for checking the random placement of ships against populated coordinates