Cleanest (but likely most difficult) way to go around this is to use computer vision. I am not sure if BASIC Stamp is able to handle something like that, also I don't know if You are allowed to use remote computer to do CV processing and send back results to BASIC Stamp. Another way to do it is to use something like IR Sharp sensor mounted on a servo constantly scanning given surface, this most definitely can be handled by BASIC Stamp, although we don't know what sort of setup You have to have (where You are allowed to place sensors for instance). The way I imagine it is shown in the image below.