Same solution as @lachi (but my stepson insists we post our own picture)
I find it quite elegant, because there is nothing to reset between runs. The two bits act as a 4-step counter, so all 4 combinations are parsed through every 4 runs - each run leaving them in the next state, ready for a new run.
You launch a red ball, which tests bit ‘B’. If ‘B’ it set to the left, capture the ball. Only if ‘B’ is set to the right, then go launch a blue ball to test bit ‘A’