Here is the pseudo-code description of test or advance. If our neighbor can attack us, then we advance (by calling our own next routine). Otherwise, we found a solution and return true.
Having written test or advance, we can simplify our earlier version of the function first. To find a first solution we ask our neighbor for their first solution. We then simply place ourself in row 1, and test.