Algorithm 1 eightQueens(partialSolution)
1: // Prints all solutions to the 8-Queens problem.
2: input: current partialsolution
3: output: prints all possible solutions to the 8-queens problem.
4: if (length(partialSolution) = 8) then
5: print partialSolution
6: else
7: possibleItems ← getPossibleNextPositions(partialSolution)
8: k ← 0
9: while (k < length(possibleItems)) do
10: add(possibleItems[k], partialSolution)
11: eightQueens(partialSolution)
12: delete(length(partialSolution)-1, partialSolution)
13: k ← k + 1
14: end while
15: end if