Each cart has two light sensors and two wheels, joined by two wires. That's the whole brain. No code decides what to do.
Wire them straight and it runs from light. Cross them and it charges. Make the wires slow the wheel instead of speeding it, and you get something that looks like love.
After Valentino Braitenberg, Vehicles: Experiments in Synthetic Psychology (1984).