Flyttar (See also the note on exceptions, below) | |
Sväng vänster Sväng höger Kör tillbaka Kör framåt Backar |
[!java|c]void [/!]vänster() [!java|c]void [/!]höger() [!java|c]void [/!]backa() [!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 Hämta Y-koordinat Set X coordinate Set Y coordinate Ställ in plats |
[!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[/!]) |
Note that the point (0,0) is on the top left corner, as it is often the case in Computer Science. | |
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 Pickup a baggle Drop a 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() |
Name | Color |
[!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 |
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.