diff 3-Prolog/readme.txt @ 69:05871e7ac124

Add notes on how to invoke the Sudoku code
author IBBoard <dev@ibboard.co.uk>
date Sat, 07 Oct 2017 16:50:14 +0100
parents 90c4b7f28690
children
line wrap: on
line diff
--- a/3-Prolog/readme.txt	Sat Oct 07 15:43:52 2017 +0100
+++ b/3-Prolog/readme.txt	Sat Oct 07 16:50:14 2017 +0100
@@ -21,4 +21,16 @@
 then Prolog will check both "definitions" of the rule.
 
 (Note: putting the recursive "ancestor/2" call at the end is called "tail recursion" and the language can optimise it to
-reduce call stack exhaustion issues)
\ No newline at end of file
+reduce call stack exhaustion issues)
+
+For the sudoku code, example invocations are:
+
+    % 2×2 grid, from the book - solved correctly
+    sudoku([_,_,2,3,  _,_,_,_,  _,_,_,_,  3,4,_,_], 2,2, Solution).
+
+    % 2x3 grid (size suggested in the exercise)
+    % For some reason, this one can't be perfectly solved unless certain extra values are added
+    sudoku([_,6,_,_,_,_,  1,_,3,_,5,_,  _,_,1,_,_,2,  6,_,_,4,_,_,  _,5,_,3,_,1,  _,_,_,_,2,_], 3, 2, Solution).
+
+    % Normal 3x3 grid
+    sudoku([_,8,3,_,4,_,_,1,7,  6,_,_,7,_,_,_,4,_,  _,_,_,8,_,_,9,_,_,  8,_,5,3,7,_,_,_,_,  _,_,_,1,_,9,_,_,_,  _,_,_,_,8,5,3,_,9,  _,_,6,_,_,8,_,_,_,  _,2,_,_,_,1,_,_,3,  3,4,_,_,2,_,5,9,_ ], 3, 3, Solution).
\ No newline at end of file