prolog A* search
solve_task (Task,Cost) :- my_agent (A), get_agent_position(A, P), solve_task_dfs(Task, [P], [P|Path]), !, agent_do_moves(A,Path), length(Path, Cost). solve_task_dfs(Task, [P|Ps],Path) : – achieved(Task,P), reverse ([P|Ps],Path) map_adjacent(P, Q,empty), \+ member (O,Ps), solve_task_dfs(Task, [Q, P|Ps], Path). achieved (Task ‚Pos) : – Task=find(Obj), map_adjacent (Pos ,_,Obj) Task=go(Pos). You will need to replace the above solve_task_dfs/3 by a new predicate (with your choice […]