Kara

Kara is a ladybug who walks on a grid, collects berries and has to get around trees. In German-speaking schools she has long been a favorite for learning to program; she was invented by SwissEduc. CodeNatter uses the notation of the book: first the world with world("""…"""), then the commands – no import needed.

What Kara can do

These commands change the world:

move()one step forward
turnLeft()turn left
turnRight()turn right
putBerry()put down a berry
removeBerry()pick up a berry

These ask about the world and return True or False:

onBerry()Am I standing on a berry?
treeFront()Is there a tree in front of me?
treeLeft()Is there a tree to my left?
treeRight()Is there a tree to my right?
mushroomFront()Is there a mushroom in front of me?

If Kara walks into a tree or pushes a mushroom against a wall, the program stops with an error message. Below Kara’s world in the editor the same list can be opened.

Kara walks slowly on purpose, so you can watch her. If that gets tedious in a longer program, turn up the speed below the world – even while it runs. The speed belongs to watching, not to the program: it does not travel with the link.

Even before the program runs, CodeNatter shows the world from world(…). After “Stop” Kara is back at the start.

The characters

@Kara
#tree
.berry
+Kara on a berry
$mushroom
*mushroom on a berry
spaceempty cell

The notation is compatible with GreenfootKara and the Pygame Zero tutorials. A line break right after """ does not count as a row.

Click a world together

Instead of counting characters, you can build the world here and take the finished call. It works the other way round too: copy an existing world into the text box and see what is in it. Things can be stacked – first a berry, then a mushroom on top gives *, first a berry, then Kara gives +. A second click takes it away again.

Building tasks from it

The world belongs in the preparation: with #--- you fold it away, so only the actual task stays visible. Several named sections give several starting positions – see Splitting programs.