Information Technology Reference
In-Depth Information
1 role (xplayer). role (oplayer).
2
3 init (control(xplayer)).
4 init (cell(1,1,b)). init (cell(1,2,b)). init (cell(1,3,b)).
5 ...
6 init (cell(3,3,b)).
7
8 legal (P, mark(X,Y)) :- true (control(P)), true (cell(X,Y,b)).
9 legal (P, noop) :- role (P), not true (control(P)).
10
11 next (cell(X,Y,x)) :- does (xplayer, mark(X,Y)).
12 next (cell(X,Y,o)) :- does (oplayer, mark(X,Y)).
13 next (cell(X,Y,C)) :- true (cell(X,Y,C)), distinct (C, b).
14 next (cell(X,Y,b)) :- true (cell(X,Y,b)), does (P, mark(M,N)),
15
( distinct (X,M) ; distinct (Y,N)).
16
17 goal (xplayer, 100) :- line(x).
18 ...
19 terminal :- line(x) ; line(o) ; not open.
20
21 line(P) :-
22 true (cell(X,1,P)), true (cell(X,2,P)), true (cell(X,3,P)).
23 ...
24 open :- true (cell(X,Y,b)).
The first line declares the roles of the game. The unary predicate init defines the
properties that are true in the initial state. Lines 8-9 define the legal moves of the game
with the help of the keyword legal . For example, mark(X,Y) is a legal move for
role P if control(P) is true in the current state (i.e., it's P 's turn) and the cell X,Y
is blank ( cell(X,Y,b) ). The rules for predicate next define the properties that hold
in the successor state, e.g., cell(M,N,x) holds if xplayer marked the cell M,N and
cell(M,N,b) does not change if some cell different from M,N was marked 1 .Lines17
to 19 define the rewards of the players and the condition for terminal states. The rules
for both contain auxiliary predicates line(P) and open which encode the concept of
a line-of-three and the existence of a blank cell, respectively.
We will refer to the arguments of the GDL keywords init , true and next as flu-
ents. Fluents are the building blocks of states in GDL and will be in the center of our
analysis for distance features. In the above example, there are two different types of
fluents, control(X) with X {xplayer, oplayer} and cell(X, Y, Z) with X ,
Y {1, 2, 3} and Z {b, x, o} .
In [11], we defined a formal semantics of a game described in GDL as a state transi-
tion system:
Definition 1 (Game). Let Σ be a set of ground terms and 2 Σ denote the set of finite
subsets of Σ . A game over this set of ground terms Σ is a state transition system Γ =
( R,s 0 ,T,l,u,g ) over sets of states
2 Σ and actions
S⊆
A⊆
Σ with
1
The special predicate distinct (X,Y) holds if the terms X and Y are syntactically different.
 
Search WWH ::




Custom Search