diff options
author | Bradley Smith | 2008-01-21 00:16:45 +0000 |
---|---|---|
committer | Bradley Smith | 2008-01-21 00:16:45 +0000 |
commit | e6e7222d5a730368ed4e84c2e0f55427460e5230 (patch) | |
tree | e608410401099ccebe7ffa21de9336d78c78efc9 /scheme/zap.scm | |
download | gnurobots-e6e7222d5a730368ed4e84c2e0f55427460e5230.tar.gz |
Imported GNU robots from CVS.
Signed-off-by: Bradley Smith <brad@brad-smith.co.uk>
Diffstat (limited to 'scheme/zap.scm')
-rw-r--r-- | scheme/zap.scm | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/scheme/zap.scm b/scheme/zap.scm new file mode 100644 index 0000000..67e8d4d --- /dev/null +++ b/scheme/zap.scm @@ -0,0 +1,36 @@ +;;; zap.scm +;;; Sample robot provided by Jim Hall <jhall1@isd.net> +;;; This is an agressive little robot that will just turn 360-degrees, +;;; and will immediately zap anything that isn't a space. This builds +;;; on the beep.scm robot program, so it will also beep if it finds a +;;; prize (but then destroys it.) + +;;; Define a function to make a beep +(define (beep) (display "\a")) + +;;; Define a function to blow away anything that isn't a space +(define (blast-nonspace) + (if (robot-feel "space") (robot-zap))) + +;;; Define a function to turn, then see if a prize is there +(define (turn-and-feel) + (robot-turn 1) + (if (robot-feel "prize") (beep))) + +;;; The program begins here: make one sweep + +(turn-and-feel) +(blast-nonspace) +(sleep 1) + +(turn-and-feel) +(blast-nonspace) +(sleep 1) + +(turn-and-feel) +(blast-nonspace) +(sleep 1) + +(turn-and-feel) +(blast-nonspace) +(sleep 1) |