User Tools

Site Tools


plato:tutor:goto_is_a_regular_command

The -goto- is a Regular Command

Since the -goto- command is a regular command, it is skipped in the judging and search states. Here is a sequence of commands which illustrates the fact that the -goto- is skipped in the judging state:

. . . arrow 1612 goto dogcat unit dogcat answer dog write Bowwow wrong cat

When the -arrow- is first encountered, an arrow is displayed on the screen at 1612. TUTOR continues in the regular state and executes the -goto-. The -answer- in unit “dogcat” ends this regular processing to await the student's response. Suppose the student types “dog” and presses NEXT. TUTOR starts judging just after the -arrow-, skips the regular -gotocommand, and finds no judging commands at all. The student's response gets a default “no” judgment. The -goto- should be replaced by a -join- so that unit “dogcat” will be attached in the judging state.

Similarly, the following is an erroneous sequence which illustrates the fact that the -goto- command is skipped in the search state:

. . . arrow 1612 specs bumpshift answer dog goto another wrong cat * unit another arrow 2514 answer wolf

The student responds to the first -arrow- with “dog” and matches the “answer dog”, which switches the processing from the judging state to the regular state. The -goto- is executed, and in unit “another” we encounter an -arrow- command. This -arrow- command terminates the regular processing just as a judging command would. The -specs- marker was set, so we will now execute any regular commands following the -specs- command (there are none in this example). Since the student's response was “ok”, the search state is now initiated. TUTOR starts at the “arrow 1612” looking for another -arrow- command. The -specs-, -answer-, -goto-, and -wrong- are skipped in the search state, and we come to the end of the unit without finding an -arrow-. Thus the -goto- did not succeed in attaching a second -arrow-. If the -goto- is replaced by a -join-, the “wrong cat” will be associated with the second -arrow- (2514). This is due to the text insertion nature of the -join-, which interposes the statements of unit “another” between the “answer dog” and the “wrong cat”. One correct way to write this sequence is shown below:

. . . arrow 1612 specs bumpshift answer dog wrong cat endarrow goto another $$ or "do another" * unit another arrow 2514 answer wolf

The -goto- or -do- placed after the -endarrow- will not cause any problems because the search state has been completed, and the -endarrow- flips us from the search state to the regular state.

Considerations of this kind suggest that some care must be exercised when using -join- or -do- to attach units containing -arrow- commands. To avoid unpredictable results follow these two rules:

  1. A unit attached by -join- or -do- which contains one or more -arrow- commands must end with an -endarrow- command. This insures that the unit will end and “undo” in the regular state. (It is permissible to have regular commands following the -endarrow-.)
  2. The attached unit containing one or more -arrow- commands must not contain any -goto- commands. (A -goto- can make TUTOR fail to see the -endarrow- or a judging command so that a premature “undo” occurs.)

If these two rules are followed, the -join- or -do- will act precisely as though you had inserted the statements of the attached unit where the -join- or -do- was. Here are examples of good and bad forms:

GOOD_________________ BAD___________________ unit response | unit response answer apple | answer apple (Don't use -goto- here) join response do newton | goto newton wrong pear | wrong pear write Wrong fruit. | write Wrong fruit. (Do use -endarrow- here) endarrow

Interactions of -arrow- with -size-, -rotate-, -long-, -jkey-, and -copy-

plato/tutor/goto_is_a_regular_command.txt · Last modified: 2023/08/05 18:55 by Site Administrator