[project @ 2003-07-31 17:45:22 by ross]
[ghc-base.git] / Text / ParserCombinators / Parsec / examples / tiger / queens.tig
diff --git a/Text/ParserCombinators/Parsec/examples/tiger/queens.tig b/Text/ParserCombinators/Parsec/examples/tiger/queens.tig
deleted file mode 100644 (file)
index 621ec60..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* A program to solve the 8-queens problem */
-
-let
-    var N := 8
-
-    type intArray = array of int
-
-    var row := intArray [ N ] of 0
-    var col := intArray [ N ] of 0
-    var diag1 := intArray [N+N-1] of 0
-    var diag2 := intArray [N+N-1] of 0
-
-    function printboard() =
-       (for i := 0 to N-1
-        do (for j := 0 to N-1 
-             do print(if col[i]=j then " O" else " .");
-            print("\n"));
-         print("\n"))
-
-    function try(c:int) = 
-(    if c=N
-     then printboard()
-     else for r := 0 to N-1
-       do if row[r]=0 & diag1[r+c]=0 & diag2[r+7-c]=0
-             then (row[r]:=1; diag1[r+c]:=1; diag2[r+7-c]:=1;
-                   col[c]:=r;
-                   try(c+1);
-                   row[r]:=0; diag1[r+c]:=0; diag2[r+7-c]:=0)
-)
- in try(0)
-end
-