% % the Yale shooting problem -- no 'dead' fluent % with walking % % to see what happens, use the command % lparse -c n=1 yale-walk.lp | smodels 0 % or % lparse -c n=2 yale-walk.lp | smodels 0 % or % lparse -c n=3 yale-walk.lp | smodels 0 % or some other number for n % define fluents and actions fluent(alive). fluent(loaded). fluent(walking). action(shoot). action(load). action(start_walk). action(end_walk). % define time line time(0..n). % initial state h(alive, 0). h(neg(loaded), 0). h(neg(walking), 0). % action effects % shooting causes neg(alive) only if % the gun is loaded and the turkey is not walking h(neg(alive), T+1):- time(T), o(shoot, T), h(loaded, T), h(neg(walking), T). h(loaded, T+1):- time(T), o(load, T). % loading causes loaded h(neg(loaded), T+1):- time(T), o(shoot, T), h(loaded, T). % start walking causes the turkey to be walking h(walking, T+1):- time(T), o(start_walk, T), h(neg(walking), T). % end walking causes the turkey to be not walking h(neg(walking), T+1):- time(T), o(end_walk, T), h(walking, T). % action occurrences %%% o(shoot, 0). %%% o(load, 0). o(shoot, 1). %%% o(load, 0). o(start_walk, 1). o(shoot, 2). % generating action occurrences 1 {o(A,T) : action(A)} 1 :- time(T), T < n. % goal statement :- not h(neg(alive), n). % what was missing is the rule that say "thing do not % change by themselve" % F was true at T and is not false at T+1 then % F must continue to be true at T h(F, T+1):- time(T), T