Toggle navigation
?
users online
Logout
Open hangout
Open chat for current file
% nacteni: /* ['3.6_17.pl']. */ solution(Start ,Solution) :- breadth_first_search([[ Start ]], Solution). breadth_first_search([[ Node|Path]|_],[Node|Path]) :- goal(Node). breadth_first_search([[ N|Path]|Paths],Solution) :- bagof([M,N|Path],(move(N,M),\+ member(M,[N|Path])), NewPaths), NewPaths\=[], append(Paths,NewPaths,Path1), !, breadth_first_search(Path1,Solution); breadth_first_search(Paths,Solution). % vzorova data goal(e). move(a,b). move(a,e). move(a,f). move(b,c). move(f,c). move(c,d). move(d,e). % demonstracni vypis start:- write('breadth_first_search'),nl, write('Prvni reseni solution(a,Solution):'),nl, solution(a,Solution),write(Solution),nl. ?-start.
true