Today's world is unimaginable without digital electronic devices. We encounter smartphones, ATMs and computers at every turn. Modern televisions, washing machines, microwave ovens and refrigerators are also controlled by digital microprocessors.
Children, like adults, use these devices and want to know how they work. But children have little experience to understand computer science. On the other hand, many of them chat with friends over the Internet and watch cartoons in a web browser.
These basic computer skills are enough to program «Ladybug» — the actor of the free virtual learning environment. To learn the basic concepts of imperative programming, you will need nothing more than a device with a web browser and free time.
The prototype of «Ladybug» is the program «Kangaroo Roo», which was used in secondary schools of the USSR in early 1990s. The developers of this program Mark Sapir and Eugene Linetsky taught programming to children in grades 4-7 in Lincoln (NE) in 1992-1994. Unfortunately, «Kangaroo Roo» runs on the outdated DOS operating system and is difficult to run on modern computers. On the contrary, «Ladybug» is implemented using client-side web technologies, and runs in almost any modern web browser.
The Actor «Ladybug» understands the programming language of «Kangaroo Roo» and operates in the same environment — on a checkered board of 15 columns and 19 rows (fig. 1). The actor moves along the lines and can paint them. Of course, it can turn, but left only. To turn right, it must turn left three times.
The «Ladybug» application can be used online, or it can be installed locally. A nice feature of «Ladybug» is that both the user interface and the programming language can be translated into the native language of students. The sources of this software are open under GPL-3.0 license.
You can see video lessons how to use the «Ladybug» environment on Youtube channel and use the learning environment online.
The Actor «Ladybug» can be controlled using touch screen, but preffered control devices are mouse (or touchpad) and keyboard. The user interface consists of five main parts (fig. 2):
Interactive(the actor executes entered commands immediately),
Programming(entered commands are stored to the program) and
Program execution(execute the entered program).
interacton the fig. 2) or press [TAB] key.
Programmingmode only. The commands can be entered manually using the keyboard or selected from the menu.
Main commands of the drawing player programming language are:
hop
— go forward and do nothing more;step
— go forward and draw a line;turn
— rotate yourself left (counterclockwise).Any image can be drawn using those commands, but writing a program using them only might take a long time. A sequence of commands can be aggregated into a subroutine to make programs shorter and more clear:
do SubroutineName
— execute the subroutine SubroutineName that is described above or below.subroutine SubroutineName
— the beginning of the subroutine SubroutineName commands sequence description.the end of subroutine
— the end of the subroutine commands sequence description.There are conditional statements to check if the actor is on the edge of the board:
if it can move forward then
— opens the sequence of commands to execute only if the actor sees no edge of board right in front of it;if it can't move forward then
— opens the sequence of commands to execute only if the actor sees the edge of board right in front of it;the end of branching
— closes the sequence of commands.The last part of the programming language commands are the statements to execute a sequence of commands repeatedly:
while it can move forward repeat
— opens the sequence of commands to execute only if the actor sees no edge of board right in front of it;while it can't move forward repeat
— opens the sequence of commands to execute only if the actor sees the edge of board right in front of it;the end of cycling
— closes the sequence of commands and returns the program execution to the appropriate while command.That's all about the programming language. Let's look at some code examples.
Let's the Ladybug draw a 2x2 box! Ok, the program is here:
The above program works well but it is too long and nobody can say what it draw before it will be executed. Let's use procedures:
Well... How about a row of boxes? No problem, let's use a recursion:
Hm... The actor crashes after the fifth box due it tries to go out of board. Let's protect the actor using conditional command:
The above program works correct. But there is another way to execute a part of code repeatedly — using while
loop instruction:
The program can be extended to draw as many rows of boxes as possible:
More interesting but complicated examples can be found on the site about Kangaroo Roo
learning environment (in Russian).