Bee-Bot Emulator
The Bee-Bot Emulator presents a Bee-Bot robot on a surface. To the right, the Bee-Bot controls offer you to create a small program. Just click the buttons as you would press the Bee-Bot’s buttons. A third window lists all of the Bee-Bot commands that will be executed when you click the GO button.
The program demostrates how to load shapes into turtles, and how to run small snippets of Logo code when a turtle is clicked.
BeeBot.lgo
TO LOAD.CONTROLS
LOCAL "TEMPNAME
MAKE "TEMPNAME LOADSNAP WORD :LOGODIR "|/toolbox/robots/bbgo.bmp|
PPROP :TEMPNAME "NAME "BBGO
PPROPS "BBGO [WINDOW BUTTONS POSITION [0 0]]
MAKE "TEMPNAME LOADSNAP WORD :LOGODIR "|/toolbox/robots/bbforward.bmp|
PPROP :TEMPNAME "NAME "BBFORWARD
PPROPS "BBFORWARD [WINDOW BUTTONS POSITION [0 60]]
MAKE "TEMPNAME LOADSNAP WORD :LOGODIR "|/toolbox/robots/bbback.bmp|
PPROP :TEMPNAME "NAME "BBBACK
PPROPS "BBBACK [WINDOW BUTTONS POSITION [0 -60]]
MAKE "TEMPNAME LOADSNAP WORD :LOGODIR "|/toolbox/robots/bbright.bmp|
PPROP :TEMPNAME "NAME "BBRIGHT
PPROPS "BBRIGHT [WINDOW BUTTONS POSITION [60 0]]
MAKE "TEMPNAME LOADSNAP WORD :LOGODIR "|/toolbox/robots/bbleft.bmp|
PPROP :TEMPNAME "NAME "BBLEFT
PPROPS "BBLEFT [WINDOW BUTTONS POSITION [-60 0]]
MAKE "TEMPNAME LOADSNAP WORD LOGODIR "|/toolbox/robots/bbclear.bmp|
PPROP :TEMPNAME "NAME "BBCLEAR
PPROPS "BBCLEAR [WINDOW BUTTONS POSITION [70 -60]]
MAKE "TEMPNAME LOADSNAP WORD :LOGODIR "|/toolbox/robots/bbpause.bmp|
PPROP :TEMPNAME "NAME "BBPAUSE
PPROPS "BBPAUSE [WINDOW BUTTONS POSITION [-70 -60]]
END
TO LOAD.BEEBOT
LOCAL "TEMPNAME
MAKE "TEMPNAME LOADSNAP WORD :LOGODIR "|/toolbox/robots/bee-bot.bmp|
PPROPS :TEMPNAME [NAME |BEE-BOT| WINDOW GRAPHICS]
TELL "|BEE-BOT|
HOME
setspeed .5
MAKE "PROGRAM []
END
to enable.controls
; Attach the Logo snippets that run when clicked by setting the RUN property
PPROP "BBGO "RUN [RUN :PROGRAM]
pprop "bbforward "RUN [make "program se :PROGRAM [fd 125 WAIT 500] PRINT "FORWARD]
pprop "bbback "run [make "program se :program [bk 125 WAIT 500] PRINT "BACK]
pprop "bbright "run [make "program se :program [rt 90 WAIT 500]PRINT "RIGHT]
pprop "bbleft "run [make "program se :program [lt 90 WAIT 500] PRINT "LEFT]
pprop "bbpause "run [make "program se :program [wait 1000] PRINT "PAUSE]
pprop "bbclear "run [make "program [] CT]
end
TO SETUP.ENVIRONMENT
HT
PPROPS "GRAPHICS [DRAWSIZE [600 600] POSITION [0 0]]
DECLARE "GRAPHICS "BUTTONS
PPROPS "BUTTONS [BGCOLOR [255 255 0] DRAWSIZE [210 210] POSITION [610 0]]
PPROPS "LISTENER [TITLE PROGRAM DRAWSIZE [210 360] POSITION [610 240] ]
CT
END
TO DRAWGRID
IF (ALERT "|Would you like a grid for Bee-Bot to travel?| "YES "NO) = "NO THEN STOP
ask 0 [ pu setxy [0 60] pd seth 90 setw 5 fd 2000]
ask 0 [ pu setxy [0 180] pd seth 90 setw 5 fd 2000]
ask 0 [ pu setxy [0 -60] pd seth 90 setw 5 fd 2000]
ask 0 [ pu setxy [0 -180] pd seth 90 setw 5 fd 2000]
ask 0 [ pu setxy [60 0] pd seth 180 setw 5 fd 2000]
ask 0 [ pu setxy [180 0] pd seth 180 setw 5 fd 2000]
ask 0 [ pu setxy [300 0] pd seth 180 setw 5 fd 2000]
ask 0 [ pu setxy [-60 0] pd seth 180 setw 5 fd 2000]
ask 0 [ pu setxy [-180 0] pd seth 180 setw 5 fd 2000]
ask 0 [ pu setxy [-300 0] pd seth 180 setw 5 fd 2000]
END
TO BEEBOT
SETUP.ENVIRONMENT LOAD.BEEBOT LOAD.CONTROLS ENABLE.CONTROLS DRAWGRID
END
BEEBOT
Procedure | BEEBOT |
Description | Bee-Bot Emulator |
Level | Intermediate |
Tags | Properties, Turtle, Drawing, Bitmaps, Bee-Bot, Emulator |