gscheme/examples/randrects.scm

19 lines
467 B
Scheme

(define randrects
(lambda (n rmax lmax)
(let
((x (random lmax)) (y (random lmax))
(fill (random 2))
(a (+ (/ rmax 2) (random (/ rmax 2))))
(b (+ (/ rmax 2) (random (/ rmax 2)))))
(draw-color
(random 256)
(random 256)
(random 256))
(draw-move x y)
((if (zero? fill) draw-rect fill-rect) a b)
(if (not (zero? n))
(randrects (- n 1) rmax lmax)))))
(randrects 25 60 250)