Challenge 2: Counting All 5-Queens Solutions via findall/3 — Possible Solution ==================================================================== queens_demo.pl (same queens/2, safe_queens/1, safe_queens/3 as Challenge 1) Query: ?- findall(Qs, queens(5, Qs), AllSolutions), length(AllSolutions, Count). Count = 10. Explanation: findall(Qs, queens(5, Qs), AllSolutions) drives queens(5, Qs) to full exhaustion via backtracking -- every possible way label/1 can commit to concrete values while still satisfying every #\= and diagonal constraint safe_queens/1 posted -- collecting each resulting Qs list into AllSolutions in one call, exactly the way prolog2-1 described findall gathering every solution of a goal into a single concrete list. length/2 then simply counts how many were found. 10 is the well-known correct number of distinct solutions to the 5-queens problem (matching the classical, independently-verified result for N=5), confirming both that queens/2 is complete -- it doesn't miss any valid placement -- and that findall correctly exhausts every one of them rather than stopping early. WHY THIS WORKS AS AN ANSWER ------------------------------ This reuses the chapter's own findall-based counting pattern (already shown for N=6) at a different N, and cross-checks the resulting count against the independently well-known correct value for 5-queens, confirming both the solver's completeness and findall's own exhaustive-collection behavior.