On the right hand side, we intercept the third red.
The blues must hit the levers in the order “b-r-b-b-b-r-b-b-b-b-b-b-b-r”.
All the odd elements of this sequence are blue, so the first bit filters out those blues, leaving “r-b-r-b-b-b-r”.
All the even elements of this subsequence are blue, so the second bit filters them out, leaving “r-r-b-r”.
The final 2 bits generate this subsequence.
Link: jstumble