BuggleWorld

This world was invented by Lyn Turbak, at Wellesley College. It is full of Buggles, little animals understanding simple orders, and offers numerous possibilities of interaction with the world: taking or dropping objects, paint the ground, hit walls, etc.

Methods understood by buggles

Moving
(See also the note on exceptions, below)
Turn left
Turn right
Turn back
Moving forward
Moving back
[!java|c]void [/!]left()
[!java|c]void [/!]right()
[!java|c]void [/!]back()
[!java|c]void [/!][!python|java|scala]forward()[/!][!c]stepForward()[/!] or [!java|c]void [/!]forward([!java|c]int [/!]steps[!scala]:Int[/!])
[!java|c]void [/!][!python|java|scala]backward()[/!][!c]stepBackward()[/!] or [!java]void [/!]backward([!java|c]int [/!]steps[!scala]:Int[/!])
Get X coordinate
Get Y coordinate
Set X coordinate
Set Y coordinate
Set position
[!java|c]int [/!]getX()[!scala]:Int[/!]
[!java|c]int [/!]getY()[!scala]:Int[/!]
[!java|c]void [/!]setX([!java|c]int [/!]x[!scala]:Int[/!])
[!java|c]void [/!]setY([!java|c]int [/!]y[!scala]:Int[/!])
[!java|c]void [/!]setPos([!java|c]int [/!]x[!scala]:Int[/!], [!java|c]int [/!]y[!scala]:Int[/!])
Information on the buggle
Get the color of the body
Set the color of the body
[!java|c]Color [/!]getBodyColor()[!scala]:Color[/!]
[!java|c]void [/!]setBodyColor([!java|c]Color [/!]c[!scala]:Color[/!])
Look for a wall forward
Look for a wall backward
[!java]boolean [/!][!c]int [/!]isFacingWall()[!scala]:Boolean[/!]
[!java]boolean [/!][!c]int [/!]isBackingWall()[!scala]:Boolean[/!]
Get heading
Set heading

valid directions are:
[!java|c]Direction [/!]getDirection()[!scala]:Direction[/!]
[!java|c]void [/!]setDirection([!java|c]Direction [/!]dir[!scala]:Direction[/!])
[!scala|java|python]Direction.[/!]NORTH, [!scala|java|python]Direction.[/!]EAST, [!scala|java|python]Direction.[/!]SOUTH and [!scala|java|python]Direction.[/!]WEST
Check whether the buggle is currently selected in the interface [!java]boolean [/!][!c]int [/!]isSelected()[!scala]:Boolean[/!]
About the brush
Brush down
Brush up
Get brush position
[!java|c]void [/!]brushUp()
[!java|c]void [/!]brushDown()
[!java]boolean [/!][!c]int [/!]isBrushDown()[!scala]:Boolean[/!]
Change the brush color
Get the color of the brush
[!java|c]void [/!]setBrushColor([!java|c]Color [/!]c[!scala]:Color[/!])
[!java|c]Color [/!]getBrushColor()[!scala]:Color[/!]
Interacting with the world
Get the color of the ground [!java|c]Color [/!]getGroundColor()[!scala]:Color[/!]
Look for a baggle on the ground
Look for a baggle in bag
Prendi il baggle
Posa a terra il baggle
(see the note on exceptions)
[!java]boolean [/!][!c]int [/!]isOverBaggle()[!scala]:Boolean[/!]
[!java]boolean [/!][!c]int [/!]isCarryingBaggle()[!scala]:Boolean[/!]
[!java]void [/!]pickupBaggle()
[!java]void [/!]dropBaggle()
 
Look for a message
Add a message
Read the message
Erase the message
[!java]boolean [/!][!c]int [/!]isOverMessage()[!scala]:Boolean[/!]
[!java]void [/!]writeMessage([!java]String [/!][!c]char* [/!]msg[!scala]:String[/!])
[!java]String [/!][!c]char* [/!]readMessage()[!scala]:String[/!]
[!java]void [/!]clearMessage()

Valid colors

NameColor
[!scala|java|python]Color.[/!]black  
[!scala|java|python]Color.[/!]blue  
[!scala|java|python]Color.[/!]cyan  
[!scala|java|python]Color.[/!]darkGray  
[!scala|java|python]Color.[/!]gray  
[!scala|java|python]Color.[/!]green  
[!scala|java|python]Color.[/!]lightGray 
[!scala|java|python]Color.[/!]magenta  
[!scala|java|python]Color.[/!]orange  
[!scala|java|python]Color.[/!]pink  
[!scala|java|python]Color.[/!]red  
[!scala|java|python]Color.[/!]white  
[!scala|java|python]Color.[/!]yellow  

Note on exceptions

Regular buggles throw a BuggleWallException exception if you ask them to traverse a wall. They throw a NoBaggleUnderBuggleException exception if you ask them to pickup a baggle from an empty cell, or a AlreadyHaveBaggleException exception if they already carry a baggle. Trying to drop a baggle on a cell already containing one throws an AlreadyHaveBaggleException exception. Dropping a baggle when you have none throws a DontHaveBaggleException.

SimpleBuggles (ie, the one used in first exercises) display an error message on problem so that you don't need to know what an exception is.