While not the least amount of parts, this solution only queries each bit once, resulting in at most 3 balls being pulled.
https://www.lodev.org/jstumble/?board=0el0eelrleerxxreerxxleellxeelgagaleraiaeeleeierff_8_8
This does not terminate, though, if all three ramps are flipped left.
This is fixed in the following:
https://lodev.org/jstumble/?board=0el0eelrleerxxreexxrleillxeelgagaleraiaeeleeierff_8_8