Loops or repeat commands in the human machine language activity


#1

For example, look at the answer to the fourth problem in the Human Machine Language Activity. The answer says, “Move the right hand directly to the end of the list (position 7), then repeatedly shift each hand toward the middle (left hand moving right, and right hand moving left) until the hands meet or cross.” How do the students know to repeat line 2 and 3? There is no loop or repeat command. Why then, wouldn’t they repeat line 1 also? Other answers are the same way, expecting students to know that they need to repeat a line or two.


#2

@stacy_byous
In the HML activity, the jump command is used to create a loop. For example #4 on the worksheet, line 1 moves the right hand to position 7, line 2 moves the left hand right and line 3 moves the right hand left 1. Line # 4 jumps to line 2 if the position of the right hand is greater than the position of the left hand. When this is no longer true, then line 5 stops the program run.

The other examples use JUMP in the same way. Something that may be confusing is the JUMP command changes where you are in the program not what position your hands are in i.e. JUMP does not cause either hand to move.

Happy computing,
Andrea