blob: 2b40b0722eb77e8f58e90439834711f8594624d2 (
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 <jhall@freedos.org>
;;; 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)
|