The solution is similar to the book solution, but with a different gear set up on the right side of the board. We alternate decrementing the registers until one reaches 0, starting with A.

If a ball goes through a register with value greater than 0, it continues to the latch at the left of the gear chain and reaches the bottom of the board, summoning a ball of the other colour.

If register B reaches 0 first, the gears are in their starting position so a ball can run down the right hand side to G.

If register A reaches 0 first, the ball goes through the central gear bit, flipping the gear orientation, then summons a red ball for register B.

If register B is 0, the rightmost gear now points left and the ball is deflected into E.

If register B is still greater than 0, the latch is now broken and the ball instead runs down the left edge to L.

https://www.lodev.org/jstumble/?board=00llllr0r0eerrlleerxrfagagaeelaxrelrllllexllieilie0