Finding Next Solution

Here is the task of finding the next solution, again in a pseudo-code format.

If we are asked to find a next solution and we are already in row 8, then we cannot advance further. So we ask our neighbor to advance to their next solution, and start again examining our possibilities from the top of the board.

Otherwise, if we were not in row 8 already, we advance one position, and test to see if we have a solution.

The routine testOrAdvance is shown on the next slide.

[audio] [real] Text to accompany slide10, in Chapter 5 of An Introduction to Object-Oriented Programming