1/* 2Probabilities computation in the body of probabilistic clauses. 3*/ 4:- use_module(library(mcintyre)). 5 6:- if(current_predicate(use_rendering/1)). 7:- use_rendering(c3). 8:- endif. 9 10:- mc. 11 12:- set_mc(k,20). 13 14:- begin_lpad. 15 16a0.2:- 17 mc_sample(b,20,P,[]), 18 P>0.2. 19 20b0.5:- 21 c. 22 23c. 24 25:- end_lpad.
?-
mc_prob(a,Prob,[])
. % expected result 0.2?-
mc_sample(a,10,Prob,[])
. % expected result 0.2*/