Introduction to OOP Chapter 6: The Eight Queens Puzzle: next previous audio real text

Finding First Solution

Finding first solution, in pseudo-code:


function queen.findSolution -> boolean
	
	while neighbor.canAttack (row, column) do
		if not self.advance then
			return false;

		// found a solution
	return true;
end

We ignore for the moment the question of what to do if you don't have a neighbor
Intro OOP, Chapter 6, Slide 8