; player thinks of a number, this program tries to guess it (define (read-input guess) (begin (display "Is your number ") (display guess) (display "? ") (let ((response (read))) (cond ((eq? response 'yes) 'yes) ((eq? response 'high) 'high) ((eq? response 'low) 'low) (else (read-input guess)))))) (define (get-guess minimum maximum) (floor (/ (+ minimum maximum) 2))) (define (game minimum maximum) (let ((guess (get-guess minimum maximum))) (let ((response (read-input guess))) (cond ((eq? response 'yes) '()) ((eq? response 'high) (game minimum (- guess 1))) ((eq? response 'low) (game (+ guess 1) maximum)))))) (displayln (game 1 100)) (displayln "Yes got it!")