I think there's no "program" here. All the machinery does the same action for every piece, the singulation is with overflow/skipping buckets, and the sorting happens because the openings are constructed progressively bigger such that the longest axle falls of (tips over the edge due to imbalance) in the first bin, the second longest in the second bin, etc.
There is one obviously visible cam (yellow half-circle) that seems to control the little wheel that shoots a single piece into slots that move over the sorting bins.
Still, super impressive and cool!