1:- use_module(library(mcintyre)).    2
    3:- if(current_predicate(use_rendering/1)).    4:- use_rendering(c3).    5:- use_rendering(graphviz).    6:- endif.    7
    8:- mc.    9:- begin_lpad.   10yield(apple,Y): gaussian(Y,12000.0, 1000.0).
   11yield(banana,Y): gaussian(Y,10000.0, 1500.0).
   12support(apple): 0.3.
   13support(banana):0.5.
   14basic_price(apple,B):- 
   15  yield(apple,Y),
   16  {B=:=250-0.007 * Y}.
   17basic_price(banana,B):- 
   18  yield(banana,Y),
   19  {B=:=200-0.006 * Y}.
   20price(Fruit,P):- 
   21  basic_price(Fruit,B),
   22  support(Fruit), 
   23  {P=:=B+50}.
   24price(Fruit,B):- 
   25  basic_price(Fruit,B),
   26  \+ support(Fruit).
   27buy(Fruit):-
   28  price(Fruit,P),
   29  max_price(Fruit,M),{P =< M}.
   30max_price(apple,M):gamma(M,10.0, 18.0).
   31max_price(banana,M): gamma(M,12.0, 10.0).
   32:- end_lpad.