(define (draw-point p color) (draw-solid-line p p color)) (define A (make-posn 150 10)) (define B (make-posn 10 290)) (define C (make-posn 290 290)) (define X1 (make-posn 150 150)) (define (average x y) (/ (+ x y) 2)) (define (mid a b) (make-posn (average (posn-x a) (posn-x b)) (average (posn-y a) (posn-y b)))) (define (initialize) (begin (start 300 300) (draw-point A 'blue) (draw-point B 'blue) (draw-point C 'blue) (draw-point X1 'blue))) (define (A-or-B-or-C) (let ((i (random 3))) (cond ((= i 0) A) ((= i 1) B) ((= i 2) C)))) (define (plot-curve x n) (when (not (= n 0)) (let ((i (mid x (A-or-B-or-C)))) (begin (draw-point i 'red) (plot-curve i (- n 1)))))) (initialize) (plot-curve X1 20000)