Skip to content

The Machine's Path Depends on Data

Beginning of the lesson

The Machine's Path Depends on Data

Among the processor's few actions, one has been waiting quietly since its lesson: choose which action to perform next. Today it steps forward. Combined with comparison, it gives the machine something no calculator has — a path that is not written down anywhere, but born at run time from the meeting of program and data. This lesson is where machines stop being player pianos.

Learning goals: explain how compare-then-choose makes the executed path depend on data; trace both paths of one small program by hand; and state the consequence with long shadows — why a program's conduct cannot, in general, be read off its text.

Start with the question

A music box plays its pins in order — always the same tune. The idealized machine also performs actions in strict sequence, one per tick. So: is the machine a music box? Where would different behavior on different days even come from?

From two bricks meeting. The processor can compare two numbers. And the processor's marker — its place in the row of command-cells — is itself changeable: the action "choose what's next" moves the marker, to one address or another, depending on the comparison's outcome. That is the entire mechanism, and it deserves slow reading: the program text contains BOTH continuations, written once and forever; which one runs is decided at run time by whatever numbers the comparison happens to meet. The text is fixed; the path through it is not.

compare A, B A < B ? yes: marker to cell 600 no: marker to cell 640 actions of branch 1 actions of branch 2 Both branches exist in the text forever. The data chooses which one becomes conduct.

Nothing here violates the clock: still one action per tick, still strict sequence — the sequence of performed actions is as orderly as ever. What changed is that this sequence is no longer a copy of the text's order. Two runs of one program are two different journeys through the same country.

Continue this lesson on YourAIZone

The full lesson has the complete explanation, worked examples, common mistakes, tests with instant checking and an AI tutor. Start right away as a guest, or create an account to keep your progress.

In the full lesson

  • The complete explanation
  • Worked examples
  • Common mistakes and how to avoid them
  • Test questions: 2
  • AI tutor that answers questions about the topic
  • Progress tracking for students, parents and teachers