From e6e7222d5a730368ed4e84c2e0f55427460e5230 Mon Sep 17 00:00:00 2001 From: Bradley Smith Date: Mon, 21 Jan 2008 00:16:45 +0000 Subject: Imported GNU robots from CVS. Signed-off-by: Bradley Smith --- scheme/zap.scm | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scheme/zap.scm (limited to 'scheme/zap.scm') 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 +;;; 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) -- cgit v1.1