Artist Robot

Kumir programming environment

Often in lessons and in task 20.1 it is required by the performer "Robot" to go down or go up the stairs. It must be understood that the descent or ascent of the stairs is carried out one cycle. As a rule, in order to check the performance of the algorithm, it is necessary to add steps on the stairs. The algorithm must be executed regardless of the number of steps, for example, both for two steps and for twenty.

A TASK

The endless field has a horizontal wall that continues endlessly to the left and ends with a staircase that descends from left to right. The height of each step is two cells, the width is two cells. The robot is on a horizontal wall for descending stairs. The figure shows one of the ways to arrange the ladder and the Robot (the Robot is indicated by the symbol ).

Write an algorithm for the Robot that fills in all the cells located on the steps of the stairs. It is required to paint only the cells that meet this condition.

For example, for the above picture, the Robot has to paint over the cells:

The final location of the Robot can be arbitrary. The algorithm must solve the problem for an arbitrary field size and any number of steps. When executing the algorithm, the Robot should not collapse.

DECISION

We will solve this problem in the Kumir programming environment. Let's open the program and go to the Robot menu -> Edit environment

We are building a staircase. With the left mouse button, click on the walls of the cage. Move the rhombus (robot) to the desired location by holding down the left mouse button

Exit the editing mode of the Robot menu -> Edit environment. Next, we will write on the first line the command "use the Robot".

First, let's recall some commands for the Robot executor.

The assignment says that

The algorithm must solve the problem for an arbitrary field size and any number of steps

This means that the Robot must move using the "Bye" cycle. We argue this way: there is a wall below the robot, so the bottom is not free. On the 4th line of the editor, write the command

nts until the bottom is not free.

Inside the loop, you must sequentially execute the commands:

Right down fill right fill left down fill right fill

A completely finished program looks like this:

Use Robot alg start nts until the bottom is free right down paint right paint left down paint right paint kts con

To test the algorithm, let's add a few more steps and check the result.


So, the algorithm paints the cells for any number of stairs.

Artist ROBOT is the "oldest" performer, the algorithm for which is proposed to be performed by graduates in task No. 14 of the examination work in computer science and ICT.

Let's consider the individual elements of the content of the task, which are necessary to understand the operation of the algorithm.

The executor ROBOT moves along a rectangular maze drawn on a plane divided into cells. The ROBOT executor's command system contains eight commands:

  • command commands: up, down, left, right... When any of these commands are executed, the ROBOT moves one cell depending on the command.
  • four commands check the truth of the condition that there is no wall on each side of the cell where the ROBOT is located: top free, bottom free, left free, right free.

Problem number 14. How many cells of the labyrinth (see Fig. 1) meet the requirement that, having started movement in this cell and fulfilling the proposed program, the ROBOT will survive and stop in the same cell with which it started movement?

  • START
  • WHILE up
  • WHILE left
  • WHILE down
  • WHILE right
  • END

Decision.

To return the robot to its original cell, it is necessary that its trajectory is a rectangle, or a segment - horizontal or vertical. Let's consider the possible cases and find out the necessary conditions for the robot to return to its original cell.

First case. Rectangular path:

  • Obviously, the four walls should restrict the movement of the robot in the following order: first from the right, then from above, then from the left and finally from below (see Fig. 2)

Second case. Linear trajectory:

  • (a) horizontal line: the robot must move first to the left and then to the right. Analysis of the program shows that in this case, two instructions should not be executed - "BYE<справа свободно>up "and" BYE<слева свободно>down". This means that the checkered plane must contain the corresponding restrictions on the right and left (see Fig. 3)
  • (b) vertical line: the robot must move first down, then up. Similarly to the previous reasoning, we have: two instructions should not be executed - "BYE<сверху свободно>left "and" BYE<снизу свободно>to the right. Therefore, on the checkered plane there must be appropriate restrictions above and below (see Fig. 4)

It is easy to see that in all the cases listed above, the required cell has a lower bound. Let's mark such candidate cells (see Fig. 5).

Further analysis of the labyrinth in which the robot is moving shows that the first case is satisfied by the cell C4, the second case (a) - by the cells E2, B2 and, finally, the second case (b) corresponds to the cell D5 (see Fig. 6).

It is always difficult for beginners in the field of programming to leave their choice on one or another editorial complex, because a priori there are a great many of them. Well, in order not to go deep into the jungle of this fascinating and entertaining topic, within the framework of this article, I want to give a short and short excursion to the best software package, which opens up a whole set of opportunities for young people who want to become real programmers. Immediately, we note that by deciding to download the robot performer program, about which this conversation is being conducted, you are guaranteed to receive initial skills in programming and other editorial actions.

So, having chosen the solution to download the robot performer program with strict adherence to the recommendations given by me above, you get at your disposal a fully functioning complex of several programming tools, equated by specialists to professional software of this class. According to the true masters of the direction of active development and programming, the program in the form of a robot performer, voiced in the title above, after downloading and installing, opens up endless opportunities for beginners who want to comprehend all the basics of this unusually interesting industry.

Download the robot performer program for free and without registration

The standard installation file of the program called Robot Studio, the robot performer, as usual includes several developer tools that support many different tasks and do not require additional downloading of a third-party distribution kit. In other words, the advertised product seems to be an ideal solution for beginners and experienced professionals who have wished to return to the basics of programming in order to find answers to questions that remained unsettled in their youth, but suspended "in the air", let us say so.


A large number of user settings integrated into the application makes it very attractive and beneficial for the younger generation, who do not yet consider themselves too experienced. In their opinion, obtained in the course of several questionnaires, it became clear that there is simply no better application with this functionality and cannot be.


Make sure in all my non-verbal statements about the use of this convenient and multifunctional application for your own purposes and tasks, as a beginner programmer, you will be helped by the decision to download the distribution kit from our site using the links below, which provide, in addition to maximum speed, also the absence of advertising. You can also download other software from our website absolutely free of charge by going to the corresponding section of the catalog.

For the ability to write programs for the performer Robot is very important. These tasks are related to tasks with a high level of complexity and allow you to earn an additional 2 points (provided that the solution is correct). We will study the Robot.

A 9th grade graduate must have an idea of ​​algorithms, be able to write. To write algorithms, you can use programming languages ​​or formal languages. Executor Robot can execute algorithms, while doing it very clearly. The robot is the so-called GRAPHIC TRAINING PERFORMER (GRIS) because the results of its work are presented in a graphical form.

Who is Performer Robot?

Imagine a checkered field (like a sheet of a checkered notebook) on which there is an object, which we will call a Robot. Using, we can control this Robot - move it around the cells, paint over the cells. And in most cases, our task will be to write such a program for the Robot, by executing which it will paint over certain cells.

Artist Robot is included in the Kumir package (Set of Educational WORLDS), which was developed by the Scientific Research Institute for System Research of the Russian Academy of Sciences (NIISI RAS) just for teaching programming at school. In addition to the Robot, there are other performers in the Kumir system, but we are not interested in them yet.

Download Artist Robot

So, first we need. Don't be confused by the fact that the name says 32-bit, the program works fine on 64-bit Windows too. If you are using Linux, then you can use the version for this OS.

Next, you need to install the downloaded program. Here, I hope, you will not have any difficulties, the process is standard and intuitive. If suddenly something does not work out - write in the comments, I will definitely help. The only thing is that I recommend that you abandon unnecessary items during installation (everything except Wednesday Idol)

After successful installation, a shortcut to launch the program will appear on your desktop

And after starting the program, we should see the program window

Executor Robot - program window

| Lesson planning and lesson materials | 7 classes | Planning lessons for the academic year | Artist Robot

Lesson 30
Artist Robot
Robot Control
Work in the "Algorithmic" environment





Meet the Robot

Artist The robot operates on a rectangular checkered field. Walls can be located between some cells of the field. Some cells can be painted over (Fig. 3.11).

The robot occupies exactly one square of the field. By commands up, down, left and right, the Robot moves to the adjacent cell in the specified direction. If there is a wall on the way, then a refusal occurs - a message is issued about the impossibility of executing the next command.

On the command to paint over, the Robot paints the cell in which it is standing. If the cell has already been painted over, then it will be painted over again, although no visible changes will occur.

It is important to remember that the Robot can only execute correctly written commands. For example, if instead of the command down, write down, then the Robot will not understand this entry and will immediately report an error.

♦ Remember the names of errors in command recording. What other mistakes should you avoid when designing algorithms?

An example of a Robot control algorithm

Let's write a program, executing which the Robot will draw a meander of five turns on a checkered field (Fig. 3.12).

The program may look like:

REPEAT 5 TIMES paint over to the right; paint over to the left; paint over to the left; paint up; paint up; to the right; paint over to the right; to the right; right down; down END

Here we used the construction of repetition, since absolutely identical fragments are repeated 5 times in the figure. When writing the body of the loop, we wrote several commands in one line separated by semicolons.

If you make a loop procedure, then the main program will be very short.

♦ Suggest your version of the program for drawing a meander.