# Encoding coins.gdlclingo.pl

Name coins.gdlclingo.pl [Root]    General Game Playing (982) Marius Schneider Marius Schneider 2010-03-01 11:15 2010-03-01 11:15 Yes role(you). holds(cell(1, onecoin), 1). holds(cell(2, onecoin), 1). holds(cell(3, onecoin), 1). holds(cell(4, onecoin), 1). holds(cell(5, onecoin), 1). holds(cell(6, onecoin), 1). holds(cell(7, onecoin), 1). holds(cell(8, onecoin), 1). holds(step(1), 1). holds(step(Y), T+1) :- holds(step(X), T), succ(X, Y), step1Domain(Y), step1Domain(X), timeDomain(T). holds(cell(X, zerocoins), T+1) :- does(you, jump(X, Y), T), cell1Domain(X), timeDomain(T). holds(cell(Y, twocoins), T+1) :- does(you, jump(X, Y), T), cell1Domain(Y), timeDomain(T). holds(cell(X, C), T+1) :- holds(cell(X, C), T), does(you, jump(Y, Z), T), X != Y, X != Z, cell1Domain(X), cell2Domain(C), timeDomain(T). terminal(T) :- not anylegalmove(T), timeDomain(T). anylegalmove(T) :- legal(you, M, T), timeDomain(T). goal(you, 100, T) :- holds(step(5), T), timeDomain(T). goal(you, 0, T) :- holds(cell(X, onecoin), T), cell1Domain(X), timeDomain(T). zerobetween(X, Y, T) :- succ(X, Y), zerobetween1Domain(X), zerobetween2Domain(Y), timeDomain(T). zerobetween(X, Y, T) :- succ(X, Z), holds(cell(Z, zerocoins), T), zerobetween(Z, Y, T), zerobetween1Domain(X), zerobetween2Domain(Y), cell1Domain(Z), timeDomain(T). onebetween(X, Y, T) :- succ(X, Z), holds(cell(Z, onecoin), T), zerobetween(Z, Y, T), onebetween1Domain(X), onebetween2Domain(Y), cell1Domain(Z), timeDomain(T). onebetween(X, Y, T) :- succ(X, Z), holds(cell(Z, zerocoins), T), onebetween(Z, Y, T), onebetween1Domain(X), onebetween2Domain(Y), cell1Domain(Z), timeDomain(T). twobetween(X, Y, T) :- succ(X, Z), holds(cell(Z, twocoins), T), zerobetween(Z, Y, T), twobetween1Domain(X), twobetween2Domain(Y), cell1Domain(Z), timeDomain(T). twobetween(X, Y, T) :- succ(X, Z), holds(cell(Z, onecoin), T), onebetween(Z, Y, T), twobetween1Domain(X), twobetween2Domain(Y), cell1Domain(Z), timeDomain(T). twobetween(X, Y, T) :- succ(X, Z), holds(cell(Z, zerocoins), T), twobetween(Z, Y, T), twobetween1Domain(X), twobetween2Domain(Y), cell1Domain(Z), timeDomain(T). succ(1, 2). succ(2, 3). succ(3, 4). succ(4, 5). succ(5, 6). succ(6, 7). succ(7, 8). legal(you, jump(X, Y), T) :- holds(cell(X, onecoin), T), holds(cell(Y, onecoin), T), twobetween(X, Y, T), cell1Domain(X), cell1Domain(Y), timeDomain(T). legal(you, jump(X, Y), T) :- holds(cell(X, onecoin), T), holds(cell(Y, onecoin), T), twobetween(Y, X, T), cell1Domain(X), cell1Domain(Y), timeDomain(T). step1Domain(1). step1Domain(2). step1Domain(3). step1Domain(4). step1Domain(5). step1Domain(6). step1Domain(7). step1Domain(8). cell1Domain(1). cell1Domain(2). cell1Domain(3). cell1Domain(4). cell1Domain(5). cell1Domain(6). cell1Domain(7). cell1Domain(8). cell2Domain(onecoin). cell2Domain(zerocoins). cell2Domain(twocoins). zerobetween1Domain(1). zerobetween1Domain(2). zerobetween1Domain(3). zerobetween1Domain(4). zerobetween1Domain(5). zerobetween1Domain(6). zerobetween1Domain(7). zerobetween2Domain(2). zerobetween2Domain(3). zerobetween2Domain(4). zerobetween2Domain(5). zerobetween2Domain(6). zerobetween2Domain(7). zerobetween2Domain(8). onebetween1Domain(1). onebetween1Domain(2). onebetween1Domain(3). onebetween1Domain(4). onebetween1Domain(5). onebetween1Domain(6). onebetween1Domain(7). onebetween2Domain(2). onebetween2Domain(3). onebetween2Domain(4). onebetween2Domain(5). onebetween2Domain(6). onebetween2Domain(7). onebetween2Domain(8). twobetween1Domain(1). twobetween1Domain(2). twobetween1Domain(3). twobetween1Domain(4). twobetween1Domain(5). twobetween1Domain(6). twobetween1Domain(7). twobetween2Domain(2). twobetween2Domain(3). twobetween2Domain(4). twobetween2Domain(5). twobetween2Domain(6). twobetween2Domain(7). twobetween2Domain(8). jump1Domain(1). jump1Domain(2). jump1Domain(3). jump1Domain(4). jump1Domain(5). jump1Domain(6). jump1Domain(7). jump1Domain(8). jump2Domain(1). jump2Domain(2). jump2Domain(3). jump2Domain(4). jump2Domain(5). jump2Domain(6). jump2Domain(7). jump2Domain(8). moveDomain(jump(X, Y)) :- jump1Domain(X), jump2Domain(Y). timeDomain(1..6). 1{does(R,M,T):moveDomain(M)}1:- role(R), timeDomain(T), not terminal(T). terminal(T+1):- terminal(T), timeDomain(T). :-does(R,M,T),not legal(R,M,T),role(R). :-0{terminal(T):timeDomain(T)}0. :-terminal(T), not terminal(T-1), role(R), not goal(R,100,T). :-terminal(1), role(R), not goal(R,100,1). :-not terminal(6). #HIDE. #SHOW does/3.