So where exactly do you think my code is wrong?
travel_time([Head|Tail],Sum):-
route(Head,Departure,Arrival,Hours1:Minutes1,Hours2:Minutes2,Flighttype),
duration_time(Hours1:Minutes1,Hours2:Minutes2,Flighttime),
travel_time_(Tail,Arrival,Sum_0),
Sum is Flighttime + Sum_0.
travel_time_([Head|Tail],Arrival,Sum):-
route(Head,Departure,Arrival2,Hours1:Minutes1,Hours2:Minutes2,Flighttype),
duration_time(Hours1:Minutes1,Hours2:Minutes2, Flighttime),
travel_time_(Tail,Arrival2,Sum2),
((Departure == Arrival, Sum is Sum2 + Flighttime)
;
Sum is Sum2 + Flighttime + 180).
I used the example travel_time([1,3],X). (?? was in this case my travel_time predicate and aaa my travel_time_ predicate).
?- ??([1,3],X).
Call: (10) ??([1, 3], _15880) ? creep
Call: (11) route(1, _16432, _16356, _16360:_16362, _16366:_16368, _16440) ? creep
Exit: (11) route(1, ‘FRA’, ‘LHR’, 15:10, 18:30, ‘DE-AAB’) ? creep
Call: (11) duration_time(15:10, 18:30, _16478) ? creep
Call: (12) _16528 is 1560+10 ? creep
Exit: (12) 910 is 1560+10 ? creep
Call: (12) _16638 is 1860+30 ? creep
Exit: (12) 1110 is 1860+30 ? creep
Call: (12) _16478 is 1110-910 ? creep
Exit: (12) 200 is 1110-910 ? creep
Exit: (11) duration_time(15:10, 18:30, 200) ? creep
Call: (11) aaa([3], ‘LHR’, _16898) ? creep
Call: (12) route(3, _16948, _16950, _16954:_16956, _16960:_16962, _17034) ? creep
Exit: (12) route(3, ‘FRA’, ‘ATL’, 5:50, 17:0, ‘DE-AAA’) ? creep
Call: (12) duration_time(5:50, 17:0, _17072) ? creep
Call: (13) _17122 is 560+50 ? creep
Exit: (13) 350 is 560+50 ? creep
Call: (13) _17232 is 1760+0 ? creep
Exit: (13) 1020 is 1760+0 ? creep
Call: (13) _17072 is 1020-350 ? creep
Exit: (13) 670 is 1020-350 ? creep
Exit: (12) duration_time(5:50, 17:0, 670) ? creep
Call: (12) aaa([], ‘ATL’, _17492) ? creep
Exit: (12) aaa([], ‘ATL’, _17492) ? creep
Call: (12) ‘FRA’==‘LHR’ ? creep
Fail: (12) ‘FRA’==‘LHR’ ? creep
Redo: (11) aaa([3], ‘LHR’, _16898) ? creep
Call: (12) _16898 is _17492+670+180 ? creep
ERROR: Arguments are not sufficiently instantiated
ERROR: In:
ERROR: [12] _18370 is _18382+670+180
ERROR: [11] aaa([3],‘LHR’,_18412) at c:/users/blabl/desktop/aufgabe1.pl:97
ERROR: [10] ??([1,3],_18444) at c:/users/blabl/desktop/aufgabe1.pl:94
ERROR: [9] toplevel_call(user:user: …) at c:/program files/swipl/boot/toplevel.pl:1113
Exception: (12) _16898 is _17492+670+180 ?
creep
Exception: (11) aaa([3], ‘LHR’, _16898) ?
creep
Exception: (10) ??([1, 3], _15880) ?
creep
Can you tell me how and where to instantiate them correctly?