Teaching article

Trace a program through its intermediate states

Predict intermediate states rather than only the destination.

A correct endpoint can conceal an incorrect route along the way. Record the token's square and heading after each command, then compare that predicted trace with execution to locate any difference precisely.

Include heading as well as square in each trace. A token can occupy the correct square while facing the wrong way for the next command.

Include orientation in every trace row

  1. Record the starting state.
  2. Trace after each command.
  3. Compare with execution.

A correct final square can hide an incorrect intermediate route.

Include heading as part of state.

Which trace row differs? Use a pre-drawn table.

Resources

Further reading

Read next

Explore Coding and computational thinking. Browse all teaching articles.