/*			APPENDIX  B
		Section B.3   Motivating Examples
*/
proc(visit2,
     pi(p, pi(t1, pi(t2, ?(-hasCoffee(p) & wantsCoffee(p,t1,t2)) :
        goto(cm,91) :  pi(t, ?(now(t)) : pickupCoffee(t)) :
                pi(t, ?(now(t)) : goto(office(p),t)) : 
                pi(t, ?(now(t)) : ?(t $<= t2) )
       )))
    ).


/* Initial situation (visit2)  */
robotLocation(office(joe),s0).
start(s0, 91).

wantsCoffee(bill,100,110).
wantsCoffee(mary,130,170).
wantsCoffee(sue,140,160).
wantsCoffee(joe,90,100).

travelTime0(cm,office(sue),15).
travelTime0(cm,office(mary),10).
travelTime0(cm,office(bill),8).
travelTime0(cm,office(joe),10).
travelTime0(office(bill),office(sue),18).
travelTime0(office(bill),office(mary),15).
travelTime0(office(sue),office(mary),5).

drive( StartPos, EndPos ) :- nl, write("drive, drive, drive from "), 
                    write(StartPos), write(" to "), write(EndPos), nl.