root/ggpa/TicTacToe.rul

Revision 1, 1.8 kB (checked in by pantley2, 4 years ago)

GGPA code from the good old days of SIGART

Line 
1 (role xplayer)
2 (role oplayer)
3 (init (cell 1 1 b))
4 (init (cell 1 2 b))
5 (init (cell 1 3 b))
6 (init (cell 2 1 b))
7 (init (cell 2 2 b))
8 (init (cell 2 3 b))
9 (init (cell 3 1 b))
10 (init (cell 3 2 b))
11 (init (cell 3 3 b))
12 (init (control xplayer))
13 (<= (next (cell ?m ?n x))
14     (does xplayer (mark ?m ?n))
15     (true (cell ?m ?n b)))
16 (<= (next (cell ?m ?n o))
17     (does oplayer (mark ?m ?n))
18     (true (cell ?m ?n b)))
19 (<= (next (cell ?m ?n ?w))
20     (true (cell ?m ?n ?w))
21     (distinct ?w b))
22 (<= (next (cell ?m ?n b))
23     (does ?w (mark ?j ?k))
24     (true (cell ?m ?n b))
25     (or (distinct ?m ?j) (distinct ?n ?k)))
26 (<= (next (control xplayer))
27     (true (control oplayer)))
28 (<= (next (control oplayer))
29     (true (control xplayer)))
30 (<= (row ?m ?x)
31     (true (cell ?m 1 ?x))
32     (true (cell ?m 2 ?x))
33     (true (cell ?m 3 ?x)))
34 (<= (column ?n ?x)
35     (true (cell 1 ?n ?x))
36     (true (cell 2 ?n ?x))
37     (true (cell 3 ?n ?x)))
38 (<= (diagonal ?x)
39     (true (cell 1 1 ?x))
40     (true (cell 2 2 ?x))
41     (true (cell 3 3 ?x)))
42 (<= (diagonal ?x)
43     (true (cell 1 3 ?x))
44     (true (cell 2 2 ?x))
45     (true (cell 3 1 ?x)))
46 (<= (line ?x)
47     (row ?m ?x))
48 (<= (line ?x)
49     (column ?m ?x))
50 (<= (line ?x)
51     (diagonal ?x))
52 (<= open
53     (true (cell ?m ?n b)))
54 (<= (legal ?w (mark ?x ?y))
55     (true (cell ?x ?y b))
56     (true (control ?w)))
57 (<= (legal xplayer noop)
58     (true (control oplayer)))
59 (<= (legal oplayer noop)
60     (true (control xplayer)))
61 (<= (goal xplayer 100)
62     (line x))
63 (<= (goal xplayer 50)
64     (not (line x))
65     (not (line o))
66     (not open))
67 (<= (goal xplayer 0)
68     (line o))
69 (<= (goal oplayer 100)
70     (line o))
71 (<= (goal oplayer 50)
72     (not (line x))
73     (not (line o))
74     (not open))
75 (<= (goal oplayer 0)
76     (line x))
77 (<= terminal
78     (line x))
79 (<= terminal
80     (line o))
81 (<= terminal
82     (not open))
Note: See TracBrowser for help on using the browser.