1
0
mirror of https://github.com/osmarks/random-stuff synced 2024-11-09 13:59:55 +00:00
random-stuff/iterated-prisoners-dilemma-contest/srbf.scm

15 lines
420 B
Scheme
Raw Normal View History

(define count-zeros
2021-02-18 23:33:56 +00:00
(lambda (x) (if (= (random 50) 48) (count-zeros (+ 1 x)) x)))
(define try-sequentially (lambda (x max)
(random-seed x)
(let ((zeros (count-zeros 0))) (if (> zeros max)
(begin
(display "s=")
(display x)
(display ", r=")
(display zeros)
(newline)
(try-sequentially (+ 1 x) zeros))
(try-sequentially (+ 1 x) max)))))
(try-sequentially 1 0)
(exit)