Unplugged: Circle a Chair

In this activity, you will give someone specific instructions to do a simple action.

Chair

  1. Place a chair somewhere in the room
  2. Have either your teacher or a group member stand with their back to the back of a chair
  3. Have the person demonstrate the task of walking around the chair and sitting down
  4. Come up with instructions or pseudocode that this person needs to follow in order to get from standing behind the chair to sitting in the chair
  5. The person can only follow one instruction at a time so they need to be step-by–step. Examples of instructions are:
    • Turn left
    • Turn right
    • Step forward
    • Step backward
  6. Have the person follow your instructions/algorithm
  7. Did it Work? If not, try to come up with different pseudocode. Code often doesn’t work the first time
  8. Examine your instructions. Does anything repeat? Whenever you have code that repeats, you have an opportunity to use a loop to simplify your code.
    • What lines are repeated?
    • How many times are they repeated?
    • So how could we rewrite this code?
  9. Have the person stand with their back to the chair again. This time, have them follow your revised code

There! They have just rewritten many lines of code with just a few lines of code, by using a loop.

The ‘repeat’ command creates a loop. The code within the loop gets repeated a certain number of times until a condition is met. The condition in this algorithm is that the code in the loop is repeated 4 times. Once this condition is met, the program exits the loop.

  1. Work in small groups to form additional examples and pseudocode.

Teacher Material