role(robot)
base(on(M,N)) :- index(M) & index(N)
base(step(N)) :- index(N)
base(step(9))
input(robot,toggle(M,N)) :- index(M) & index(N)
index(1)
index(2)
index(3)
index(4)
index(5)
index(6)
index(7)
index(8)
init(step(1))
legal(robot,toggle(M,N)) :- index(M) & index(N)
next(on(M,N)) :- does(robot,toggle(M,N)) & ~true(on(M,N))
%next(on(M,N)) :- does(robot,toggle(I,J)) & true(on(M,N)) & distinct(cell(M,N),cell(I,J))
next(on(M,N)) :- true(on(M,N)) & ~does(robot,toggle(M,N))
next(step(N)) :- true(step(M)) & successor(M,N)
goal(robot,100) :- true(on(3,4)) & true(on(3,5)) & true(on(4,3)) & true(on(4,6)) & true(on(5,3)) & true(on(5,6)) & true(on(6,4)) & true(on(6,5))
goal(robot,0) :- ~true(on(3,4))
goal(robot,0) :- ~true(on(3,5))
goal(robot,0) :- ~true(on(4,3))
goal(robot,0) :- ~true(on(4,6))
goal(robot,0) :- ~true(on(5,3))
goal(robot,0) :- ~true(on(5,6))
goal(robot,0) :- ~true(on(6,4))
goal(robot,0) :- ~true(on(6,5))
terminal :- true(on(3,4)) & true(on(3,5)) & true(on(4,3)) & true(on(4,6)) & true(on(5,3)) & true(on(5,6)) & true(on(6,4)) & true(on(6,5))
terminal :- true(step(9))
successor(1,2)
successor(2,3)
successor(3,4)
successor(4,5)
successor(5,6)
successor(6,7)
successor(7,8)
successor(8,9)
