An array of sensors detects the color of each marble ... Color sensing (as well as detecting empty spaces) settled on IR-based sensors commonly used in line-following robots.