Student Specification of Numerical Parameters
The -answer- and -wrong- commands make it easy to specify a list of anticipated responses each of which (due to the specification of synonymous and optional words) can allow the student considerable latitude in,/ the way he or she phrases his or her response. However, in some cases there can be no list of anticipated responses and a different technique must be used. For example, you might ask the student to specify a rocket's launch velocity and use his or her number to calculate and display the rocket's orbit. Or you might ask the student for his or her name for later use in personalized messages such as “Bill, you should look at Chapter 5.” In such cases, all you can anticipate is that the response will be a number or a name, but you can't possibly list all possible numbers or names.
Here is an example of such a situation. We will provide the student with a desk calculator accessible on the DATA key. In the desk calculator mode the student can type complicated expressions (such as “2+63”) and receive the evaluated result. (Students also have access to a similar calculator mode by typing “TERM-calc”, which is a built-in PLATO feature.)
The -store- command will evaluate the student's expression (e.g., “13sin30°”) and store the result in “eval” (in this case, the number 6.5). The -store- command is a judging command because it operates on the student's response and can be executed only after the student initiates judging by pressing NEXT. The -ok- command is a universal -answerwhich matches all responses, and unconditionally flips TUTOR from the judging state to the regular state. In this example, it accepts any response and enables the following -write- to display the evaluated result. Note that a student need not use parentheses with functions. For example, sqrt25, cos60°, arctan3 are all legal. However, such expressions are illegal in a -calc-. In a moment we'll see another way in .which TUTOR is more tolerant of students than of authors. What if the response cannot be evaluated, such as “(-3)1/2” or “19/” or “(3+5)))”? In this case, the student will get a “no” judgment. To see how this works, let's insert a -write- statement after the -store-:
Notice that this new -write- is normally skipped because the -store- leaves us in the judging state. But, if the student's expression cannot be evaluated, -store- makes a “no” judgment and switches us from the judging state to the regular state. TUTOR then executes the “write Cannot evaluate!”, after which it encounters a judging command (-ok-) which stops the regular processing. Note that -store- terminates judging only on an error condition, whereas -answer- terminates judging only on a match, and -ok- always terminates judging.
You can tell the student precisely (in a -writec- statement) what is wrong with his or her expression by use of the system variable “formok”. This variable is –1 if the student's expression can be evaluated but takes one of several positive integral values for specific errors such as unbalanced parentheses, bad form, unrecognized variable name, etc. The variable `formok“ is defined automatically to perform this function. (If you yourself define “formok=v3” you override the system definition and you won't get these features.) The particular values assumed by “formok” can be obtained through on-line documentation at a PLATO terminal.
You can also give the student some storage variables. Let's define a couple of variables for the student:
Place these defines ahead of everything else in the lesson. Suppose you do a -calc- to assign bob⇐18 and cat⇐3. If the student types “2bob” he gets 36. Or he can type “bobcat” and get 54, whereas bobcat would be illegal in a -cafe- where you would need bob x cat or bob(cat). Only names defined in the set of definitions labeled “student” may be used by the student in this way. Attempted use (by the student) of names in your other sets of defines will give a value of “formok” corresponding to “unrecognized variable name”.
We have discussed a desk calculator, but clearly the store/ok combination will work in any situation where we let the student choose a number. Another good example is in an index of chapter numbers:
(As previously mentioned in Chapter 5, it would be better to execute the -base- command only after deciding to jump, so that the student could still use the BACK key to return to the original unit.) The -long- command following an -arrow- (but preceding any judging commands) sets a limit on the length of the student's response. The “long 1” is particularly useful here because the student need not press NEXT but has only to press the single number to begin the judging process. (For -long- of greater than 1 there must be an accompanying “force long” statement or else a NEXT key is required.) The -long- command must precede any judging command since the “long” specification is needed before the student starts typing (whereas we proceed past the judging command only after the student enters a response). The -long- command may be thought of as a kind of modifier of the -arrow- command, in the sense that the -arrow- sets a default maximum response length which is overridden (or modified) by the following -long- statement.
The -no- in this index unit is similar to an -ok- command in that it unconditionally terminates judging, but the -no- command makes a “no” judgment. If “chapter” is a number from 1 to 4, the -jump- will take the student to his chosen chapter. (Since -jump- erases the screen the “no” will not be seen.) If, however, “chapter” is not in range, we fall through the -jump- to an error message, and there will be a “no” next to the response (and the student must try again).