# Paul's puzzle 42 solution - 36 parts

Here’s my solution (it’s the one in the book):

http://www.lodev.org/jstumble/?board=00rrrre0l0eerrrree0l0eerrrree0l0lerrrleerxlfixf

Description: The solution adds one to each register in turn, starting with the right register. If the right register overflows first (i.e., it goes over 15), then a red ball goes in the basket. If the left register overflows first, a blue ball goes into the basket.

For example:

Starting register values:
A: 12
B: 13

After 1 red and 1 blue ball:
A: 13
B: 14

After 2 red and 2 blue balls:
A: 14
B: 15

After 3 red and 3 blue balls:
A: 15
B: overflow (red ball in basket, indicating that A was not greater than B)

You seem to be missing three ramps, two on the right and one at the bottom.

1 Like

Thanks, menderbug! I fixed it.

Image is better now (the ramp up-right from the top crossover is facing the wrong way) but the link is still to the version described in menderbug’s post.

What is the advantage of making this comparison by increasing each register by one each cycle until overflow rather than decreasing each until one hits zero?

We tried the other way, making the registers decrease, but couldn’t get the right colour ball to terminate the process as they were inverted. After several hours we came up with a solution - but it transpires it is the same as Paul’s.

1 Like