:- prompt(_, '').
:- use_module(library(readutil)).
main:-
process,
viagem(roma,lisboa,aviao,'12:00','15:00',300).
viagem(lisboa,porto,comboio,'16:00','18:00',10).
viajar(A, B, _, [viagem(A, B, C, D, E, F)]) :-
viagem(A, B, C, D, E, F), % Se existe uma viagem direta de A a B
!. % Não precisa procurar mais
viajar(A, B, JaVisitou, [viagem(A, X, C, D, E, F)|Lista]) :-
viagem(A, X, C, D, E, F), % Escolhe um destino qualquer
\+ member(X, JaVisitou), % Que você ainda não visitou
viajar(X, B, [X|JaVisitou], Lista). % E tente ir dele até B
process:-
viajar(roma, porto, [roma], Lista),
:- main.
Oi0gc2V0X3Byb2xvZ19mbGFnKHZlcmJvc2Usc2lsZW50KS4KOi0gcHJvbXB0KF8sICcnKS4KOi0gdXNlX21vZHVsZShsaWJyYXJ5KHJlYWR1dGlsKSkuCgptYWluOi0KCXByb2Nlc3MsCgloYWx0LgoJCiB2aWFnZW0ocm9tYSxsaXNib2EsYXZpYW8sJzEyOjAwJywnMTU6MDAnLDMwMCkuCiB2aWFnZW0obGlzYm9hLHBvcnRvLGNvbWJvaW8sJzE2OjAwJywnMTg6MDAnLDEwKS4KIAp2aWFqYXIoQSwgQiwgXywgW3ZpYWdlbShBLCBCLCBDLCBELCBFLCBGKV0pIDotCiAgICB2aWFnZW0oQSwgQiwgQywgRCwgRSwgRiksICUgU2UgZXhpc3RlIHVtYSB2aWFnZW0gZGlyZXRhIGRlIEEgYSBCCiAgICAhLiAgICAgICAgICAgICAgICAgICAgICAgICUgTsOjbyBwcmVjaXNhIHByb2N1cmFyIG1haXMKCnZpYWphcihBLCBCLCBKYVZpc2l0b3UsIFt2aWFnZW0oQSwgWCwgQywgRCwgRSwgRil8TGlzdGFdKSA6LQogICAgdmlhZ2VtKEEsIFgsIEMsIEQsIEUsIEYpLCAgICAgICAgICAgJSBFc2NvbGhlIHVtIGRlc3Rpbm8gcXVhbHF1ZXIKICAgIFwrIG1lbWJlcihYLCBKYVZpc2l0b3UpLCAgICAgICAgICAgICUgUXVlIHZvY8OqIGFpbmRhIG7Do28gdmlzaXRvdQogICAgdmlhamFyKFgsIEIsIFtYfEphVmlzaXRvdV0sIExpc3RhKS4gJSBFIHRlbnRlIGlyIGRlbGUgYXTDqSBCCgpwcm9jZXNzOi0KCXZpYWphcihyb21hLCBwb3J0bywgW3JvbWFdLCBMaXN0YSksCgl3cml0ZShMaXN0YSksIG5sLAoJdHJ1ZS4KCjotIG1haW4u