In the previous version linked to, the trick was apparently that the bulbs always light in the same order. The first run trains the MCU, and then after that it doesn't matter what order you flip the switches, the bulbs always light in the same order.
This unit doesn't operate exactly the same. It appears to me that the bulbs always light left to right. In the first trial the sequence is 1,2,3,4. Then, after exchanging the bulbs, they light 3,4,1,2. After switching the caps, they light 2,3,4,1. The last two sequences are 1,2,3,4. Then the trick is just to figure out which lamp to light first. One possibility is the order the lamps are turned off. In each case the first lamp turned off is the first one turned on in the next sequence. Before the second run, the lamps are turned off 3,4,2,1, before the third run they are turned off 2,3,4,1, and before each of the last two runs the switches are turned off 1,2,3,4.
There are any number of variations you can imagine. You could detect the presence of buibs and the order of their insertion/removal. With LEDs you can detect the bulb color by measuring the forward drop with a very small current. A nice variant would be to, for instance, always light the red LED first and then go left to right.
There are more complicated things you can do, but I suspect the simplest solutions will always win. Good magic tricks work based on misdirection. The important thing is to make it easy for the magician to get it right while allowing maximum audience participation in choosing how to reorder the LEDs and switches. Obviously if you could actually detect the cap colors you could make the 'perfect' device that simply always lit the right color LED, but failing that you want to make it as simple to as possible for the magician to recalculate the proper switch order.