-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueens_debug.tig
46 lines (35 loc) · 998 Bytes
/
queens_debug.tig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* A program to solve the 8-queens problem */
let
var N := 8
type intArray = array of int
var row := intArray [ N ] of 0
function printboard() =
(
for i := 0 to N
do (
if (i = 0) then print("0") else ();
if (i = 1) then print("1") else ();
if (i = 2) then print("2") else ();
if (i = 3) then print("3") else ();
if (i = 4) then print("4") else ();
if (i = 5) then print("5") else ();
if (i = 6) then print("6") else ();
if (i = 7) then print("7") else ()
);
print("\n");
row[0] := 999;
row[5] := 999;
row[7] := 999;
for idx := 0 to N
do
(
print(if row[idx] = 999 then "x" else "o")
);
print("\n");
()
)
in
(
printboard()
)
end