2
3:- use_module(library(pita)).
4
5:- pita.
6
7:- begin_lpad.
8
90.3::weather(rain); 0.7::weather(norain).
10
110.7::forecast(sunny); 0.2::forecast(cloudy); 0.1::forecast(rainy) :- weather(norain).
120.15::forecast(sunny); 0.25::forecast(cloudy); 0.6::forecast(rainy) :- weather(rain).
13
14umbrella(takeIt) :- forecast(X), decide_u(X).
15umbrella(leaveIt) :- forecast(X), \+ decide_u(X).
16
17? :: decide_u(sunny).
18? :: decide_u(rainy).
19? :: decide_u(cloudy).
20
21line1 :- weather(norain), umbrella(takeIt).
22line2 :- weather(norain), umbrella(leaveIt).
23line3 :- weather(rain), umbrella(takeIt).
24line4 :- weather(rain), umbrella(leaveIt).
25
26utility(line1,20).
27utility(line2,100).
28utility(line3,70).
29utility(line4,0).
30
31:- end_lpad.
32