# Encoding towers-hanoi.lparse

Name towers-hanoi.lparse Martin Gebser n/a time(0..t) and disk(1..k) are two definitions in the data set defining appropriate data types. The meaning of the time predicate is self-evident. As for the disk predicate, there are k disks 1,2,...,k. Disks 1, 2, 3 denote pegs. Disks 4, 5, ... are "movable". The larger the number of the disk, the "smaller" it is. The program uses additional predicates: on(T,N,M), which is true iff at time T, disk M is on disk N move(t,N), which is true iff at time T, it is disk N that will be moved where(T,N), which is true iff at time T, the disk to be moved is moved on top of the disk N. goal, which is true iff the goal state is reached at time t steps(T), which is the number of time steps T, required to reach the goal (pro vided part of Input data) 2009-03-30 13:03 2009-03-12 21:31 TowersOfHanoiCompetition disk/1on0/2ongoal/2steps/1time/1 put/3 No % time(0..t) and disk(1..k) are two definitions in the data set defining % appropriate data types. % % The meaning of the time predicate is self-evident. As for the disk % predicate, there are k disks 1,2,...,k. Disks 1, 2, 3 denote pegs. % Disks 4, 5, ... are "movable". The larger the number of the disk, % the "smaller" it is. % % The program uses additional predicates: % on(T,N,M), which is true iff at time T, disk M is on disk N % move(t,N), which is true iff at time T, it is disk N that will be % moved % where(T,N), which is true iff at time T, the disk to be moved is moved % on top of the disk N. % goal, which is true iff the goal state is reached at time t % steps(T), which is the number of time steps T, required to reach the goal (provided part of Input data) % Read in data on(0,N,N1) :- disk(N;N1), on0(N,N1). onG(K,N,N1) :- disk(N;N1), ongoal(N,N1), steps(K). % Specify valid arrangements of disks % Basic condition. Smaller disks are on larger ones :- time(T), disk(N1;N), on(T,N1,N), N1>=N. % Specify a valid move (only for T0, steps(K), T on(T+1,N1,N). on(T+1,N1,N) :- time(T), disk(N;N1), steps(K), T