Here’s my solution (it’s the one from the book):
And here’s the link:
Description: The first ball simply sets the positions of the gear bits to match those of the bits in register A. The positions of those gear bits determine where the second ball will end up. If the top row of gear bits are pointed right, they move the ball over one spot to the left. If the bottom row of gear bits are pointed right, they move the ball over two spots to the left.