summaryrefslogtreecommitdiff
path: root/scheme/beep.scm
blob: 72b462b8e675e0f27a9ac96efb486a9802ad2d35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;;; beep.scm
;;; Sample robot provided by Jim Hall <jhall1@isd.net>
;;; This robot will just turn around 360-degrees, and will beep if it finds
;;; a prize item.  This is similar to a radar.

;;; Define a function that will generate an audible beep

(define (beep) (display "\a"))

;;; Define a function that turns one unit, then feels for a prize.
;;; If we find a prize, make a beep.

(define (turn-and-feel)
  (robot-turn 1)
  (if (robot-feel "prize") (beep))
)

;;; Make one sweep:

(turn-and-feel)
(sleep 1)

(turn-and-feel)
(sleep 1)

(turn-and-feel)
(sleep 1)

(turn-and-feel)
(sleep 1)