Modified assign-number-in-quadrant so that it takes into consideration which coordinates in the quadrant are already occupied