Executors and Command Systems
Who carries out an algorithm, and which commands does it understand? Using a simple robot, we study executors, command systems and the executor’s environment.
All topics (3 of 11)
Chapter 1. Algorithm Basics
Chapter 2. Programming in Scratch
Chapter 3. Project Work
An executor is a person, animal or device that carries out an algorithm. A computer, a robot vacuum cleaner, a sprite in a programming environment and even a cook following a recipe are all executors. An executor does not think about the meaning of an algorithm; it simply carries out the written commands exactly.
The set of all commands an executor can carry out is called its command system. For example, a simple robot knows the commands “forward”, “turn left”, “turn right” and “paint the square”. An executor cannot perform a command that is not in its command system, so an algorithm must be built only from those commands.
The place where the executor works is called the executor’s environment. For a robot it is a grid field, and for Scratch it is the stage. The rules of the environment matter too: a robot cannot pass through a wall, and a sprite cannot leave the stage.
An example: a robot stands on a grid in square (1; 1) and must be moved to square (1; 3). The algorithm is “forward, forward”. If the executor does not know the command “forward”, the algorithm cannot be carried out. That is why, before writing an algorithm, you should find out what the executor can do.
Key takeaways
- An executor is a person or device that carries out an algorithm.
- A command system is the set of all commands the executor can perform.
- The environment is the place where the executor works, with its rules.
- An algorithm must use only the commands the executor knows.
Practice tasks
- Name three kinds of executors and give two commands for each.
- The robot’s commands are “forward”, “turn left” and “turn right”. Write an algorithm that moves it 3 squares forward, turns it right and moves it 2 more squares.
- Make a command system for a robot vacuum cleaner: come up with at least five commands.
Review questions
Test yourself: think first, then reveal the answer.
1What is a command system?Show answerHide answer
The set of all commands an executor can perform.2Why can an algorithm not use commands the executor does not know?Show answerHide answer
Because an executor cannot perform a command that is not in its command system.
0 of 11 topics completed
Sign in to mark