/* Pi in Picat. Cf my Gamble model gamble_pi.rkt This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import ppl_distributions, ppl_utils. import util. main => go. /* var : pi Probabilities: 4: 0.7853666666666667 0: 0.2146333333333333 mean = 3.14147 */ go ?=> reset_store, run_model(30_000,$model,[show_probs_trunc,mean]), nl, % show_store_lengths, % fail, nl. go => true. model() => X = uniform(-1,1), Y = uniform(-1,1), Pi = 4 * cond( (X**2 + Y**2) < 1,1,0), add("pi",Pi).