procgen  bot-gambit.scm at [93b72b5a88]

File lib/bot-gambit.scm artifact 254cc82697 part of check-in 93b72b5a88


(define-macro (rule . body)
  (define (make-cases ct body acc)
    (if (eq? body '()) acc
      (make-cases (+ ct 1) (cdr body)
		(cons (list (list ct) (cons 'string-append (car body))) acc))))
  (list 'define (car body)
	(cons 'case (cons (list 'random-integer (length (cdr body)))
	  (make-cases 0 (cdr body) '()) ))))

(define (pick ar)
  (vector-ref ar (random-integer (vector-length ar))))

(random-source-randomize! default-random-source)