Example 13.2 Let’s solve the cif17 problem from the built-in problem book. The robot must reach the end of the variable size “corridor”. The “corridor” can turn left or right.
To solve the problem, the Robot first moves up until the top is empty. The wall that appears at the top means that the turn of the “corridor” has begun. The “corridor” turns to the left, if the left is empty, otherwise the “corridor” turns to the right. Next, the Robot moves in the direction where it is empty until it encounters a wall.
This problem uses the loop structure first and then the branch structure. Each sequence of commands in the branching structure, in turn, is a cycle.
The operator brackets are omitted because the sequence consists of one loop instruction.
Remember: The process of learning a person lasts a lifetime. The value of the same knowledge for different people may be different, it is determined by their individual characteristics and needs. Therefore, knowledge is always needed at any age and position.