Applications of -jkey- and -ans-
Use of the -jkey- command is well illustrated in the case of providing help to the student (through the HELP key) without leaving the page. (This is an alternative to the more commonly used -helpop- command described in Chapter 5.) If giving help requires an entire screen display, or a whole sequence of help units, it is best to use a -help- command to specify where to jump if the student presses HELP. The screen is then erased automatically to make room for the help page (unless the original base unit had an “inhibit erase” in it). On the other hand, sufficient help might consist merely of a brief comment or some additional linedrawings on the present page. A convenient way to provide such help without leaving the page is:
The statement “jkey help” makes the HELP key completely equivalent to the NEXT key. If the student presses HELP, judging is initiated, the student's (blank) response does not match “cat”, and he or she gets “Hint: it meows . . .”. Without the -jkey- command, the HELP key would be ignored (which would be unfortunate). It is a very good idea to have the HELP key do something at all times so that the student can come to rely on help being available.
In this example, the student will get the same assistance whether he or she presses HELP or types “dog” followed by pressing NEXT. We could give different kinds of assistance in these two cases by changing the -write- statement to a -writec-:
The system variable “key” always contains a number corresponding to the last key pressed by the student. In this case the last key will either be HELP or NEXT. If the student presses HELP, the logical expression “key=help” will be true (-1) and the student gets the reply “Meow?” But, if the student presses NEXT, then the logical expression “key—- help” is false (0) and the student gets “The answer is cat.” The lower-case word “help” is defined by TUTOR to mean (in a calculational expression) “the number corresponding to the HELP key.” Other similarly defined names include next, back, and helpl (for shift-HELP).
The following is another way of writing the same sequence:
If key=help, we “fall through” the -judge- command and write “Meow?” If the key is not equal to help (that is, the student pressed NEXT), a “judge continue” is performed to return to the judging state. The “write Meow?” is skipped since -write- is a regular command. If the response does not match “cat”, the student will get the message “The answer is cat”. As usual, there are many ways in TUTOR to do the same thing! In a particular situation one scheme may be more appropriate than another.
There is an ANS key on the keyset which is often used to let students skip through material by just pressing ANS:
Since the ANS key generates an ok judgment here, the student will move on immediately to the next arrow or unit without having to type the correct answer. This procedure could best be utilized when the student is in the review mode. That is, you might define “review =v1”, zero it initially, and set it to -1 only after the student has gone through the material once under his or her own power. With the following structure, the student will be able to use the ANS key only when reviewing the material:
Another way to activate the ANS key for the student is to use the -anscommand with a blank tag.
In the above example, the single -ans- command is equivalent to the following:
The -ans- command is a judging command and must be the first judging command after the -arrow-. When it is first encountered, it sets up ANS to be a judging key, and it is matched only if the ANS key is pressed. If the -ans- command is used only to provide a kind of help, but not to let the student pass on to the next item, put a “judge wrong” after the -anscommand.
In many places you may do specific things in response to the ANS and HELP keys. Elsewhere in the lesson it is appropriate merely to utilize these keys so that something will happen when they are pressed. Just put “jkey help,ans” after each such -arrow-. The student will then get (at least) whatever reply you give him or her after the universal -nothat catches all unrecognized responses. Certainly, every -arrow- should provide some kind of feedback to unrecognized responses or the student will become perplexed. The “jkey help,ans” will further insure that a reasonable response to the student's input is always forthcoming. Without this -jkey- statement, nothing would happen when the student presses ANS or HELP.
An additional procedure is advisable. Often a student will press NEXT an extra time, perhaps because he or she hadn't noticed that a response was to be typed. This blank response, consisting only of a NEXT key, will probably get judged “no” at most arrows, which requires an additional NEXT (or ERASE) to clear the “no” judgment before typing a response. This can get confusing. In most cases it is best simply to ignore blank responses by means of the statement “inhibit blanks”, which can be put in the -imain- unit (see Chapter 5). This statement causes blank-NEXT inputs to be ignored, but other blank inputs such as HELP or ANS are not ignored.
Use a -join- to insert recurring statements after an -arrow-:
Placing “join anshelp” after each -arrow- will insure that extra NEXT keys are thrown out (while responses involving ANS or HELP keys, will fall through to whatever reply you give to unrecognized responses). Note that you must use -join-, not -do-, to attach unit “anshelp” if you add any judging commands to that unit.
Just as the -imain- command can be used to specify a unit to be done at the beginning of each new main unit, there is an -iarrow- command (“initialize arrow”) which can be used to specify a unit to be joined after every -arrow-. With the statement “iarrow anshelp”, it is unnecessary to write “join anshelp” after every -arrow- command. Unit “anshelp” will be joined automatically after every -arrow-.