// Stratifiable two-people game
// Equivalent to the nonstratifiable:
// winning(X) :- move(X,Y), not(winning(X)).
// April, 2011
// Adopted from DES

.type Node <: symbol

.decl move (node1:Node, node2:Node)
.output move ()
.decl odd_move (node1:Node, node2:Node)
.output odd_move ()
.decl canMove (node1:Node)
.output canMove ()
.decl possible_winning (node1:Node)
.output possible_winning ()
.decl winning (node1:Node)
.output winning ()

move("1","2").
move("2","3").
move("3","4").
move("1","3").
move("1","5").

canMove(X):- move(X,_).

possible_winning(X):- odd_move(X,Y), !canMove(Y).

winning(X):- move(X,Y), !possible_winning(Y).

odd_move(X,Y) :- move(X,Y).

odd_move(X,Y) :- move(X,Z1), move(Z1,Z2), odd_move(Z2,Y).
