Here’s my solution (it’s the one in the book):
And here’s the link:
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.
Starting register values:
After 1 red and 1 blue ball:
After 2 red and 2 blue balls:
After 3 red and 3 blue balls:
B: overflow (red ball in basket, indicating that A was not greater than B)