Skip to content

Instantly share code, notes, and snippets.

@wulab
Last active August 14, 2021 07:58
Show Gist options
  • Save wulab/ed6b44c811180506608836b6d3c0cb7f to your computer and use it in GitHub Desktop.
Save wulab/ed6b44c811180506608836b6d3c0cb7f to your computer and use it in GitHub Desktop.
(load "rand.scm")
(load "monte-carlo.scm")
(define (make-dice sides)
(lambda () (+ (modulo (rand) sides) 1)))
;; rolling a 7 and activating the robber
(define (catan-robber-activation)
(let ((d1 (make-dice 6))
(d2 (make-dice 6)))
(= (+ (d1) (d2)) 7)))
(exact->inexact (monte-carlo 10000 catan-robber-activation))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment