User Tools

Site Tools


The -answerc- Command: A Language Drill

The conditional -answer- command, -answerc-, may be used to create vocabulary or translation drills. Here is a sample unit which will give the student practice with Esperanto numbers:

unit espo next espo at 1812 write Give the Esperanto for randu item,5 $$ pick an integer from 1 to 5 at 2015 writec item-2,one,two,three,four,five arrow 2113 answerc item-2;unu;du;tri;kvar;kvin $$ note semicolons

Each item in the -answerc- can be as complicated as the tag of an -answer- command. For example, “answerc select↕ <it,is,a> (right,rt) triangle, <it,is,a> three*sided (polygon,figure)↕↕circle,ring” will accept either “rt triangle” or “three sided polygon” if “select” is -1, will accept nothing if “select” is zero, and will accept “circle” or “ring” if “select” is one or more. Note that items must be separated by a semicolon or by the -writecdelimiter. There is also a conditional -wrong- command, -wrongc-.

You might write yourself a similar unit to drill yourself on historical dates, capitals of nations, etc. The drill just shown has three defects: (1) it never ends; (2) you may see the same item two or three times in a row; and (3) no help is available if you get stuck. Let's revise the sample unit to have the following characteristics: it should present the five items in a random order but without repeating any item; any items missed will then be presented again; the student may press HELP to get the correct answer.

We will be using a random sequence of non-repeating item numbers such as:


This is called a “permutation” of the five integers. The following sequence is another permutation:


You can see that there is a large number (120) of different permutations of five integers. Correspondingly, there is a large number of different permutation sequences for presenting the drill to the student. Such sequences of non-repeating integers are quite different from the sequences we get from repeated execution of our “randu item,5”, which produces sequences (with some integers repeating and some not showing up for a long time) such as:


We need some way of asking TUTOR to produce a permutation for us, rather than the kind of sequence produced by -randu-. This is done by telling TUTOR to set up a permutation of 5 integers (“setperm 5”) from which to draw integers (“randp item”) until the sequence is finished (indicated by “item” getting a value of zero). The -setperm- command actually sets up two copies of the permutation, and the “remove item” statement can be used to remove an integer from the second copy. (The -randp- draws integers from the first copy.) If we -remove- only those integers corresponding to items correctly answered on the first try, the second copy will contain only the difficult items (after completing the first pass over the five items). At this time, we can use -modperm- (which has no tag) to modify the first copy by shoving the second copy into the first copy. Having replenished the first copy with the difficult items we can use -randp- to choose these again.

Here is a form of the drill incorporating these ideas:

unit begin setperm 5 $$ set up two copies of a permutation jump choose * unit choose calc attempt⇐0 $$ initialize number of attempts randp item $$ pick an integer jump item>0,espo,x $$ jump if first copy not empty modperm $$ use second copy if first copy empty randp item jump item>0,espo,x $$ jump if second copy not empty at 2115 write Congratulations! You finished the drill. end lesson $$ end the lesson unit espo next choose help esphelp at 1812 write Give the Esperanto for at 2015 writec item-2,one,two,three,four,five arrow 2113 answerc item-2;unu;du;tri;kvar;kvin goto attempt>0,q,x remove item $$ remove item if correct on first attempt no calc attempt⇐attempt+1 * unit esphelp calc attempt⇐attempt+1 $$ count HELP as an attempt at 1613 writec item-2,unu,du,tri,kvar,kvin end

We want to remove an item only if the student gets it right on the first try, which means “attempt” should be zero. The “goto attempt>0,q,x” means “goto a fictitious, empty unit `q' if attempt is greater than 0, else fall through.” If we fall through, we remove the item (“remove item”). We increment “attempt” on each try (and also when help is requested) so that if the student has to see the answer, the item is not removed and will he seen again. Note that the student is required to type the correct response and cannot see this answer while he or she types, which gives the student additional practice on the difficult items.


This chapter has demonstrated an array of techniques for judging various types of student responses. There are -answer- and -wrong- (aided by -list-) for handling sentences composed from a relatively small vocabulary of words. There are -concept- and -miscon- (supported by -vocabs-) to handle dialogs involving a large vocabulary. The -match- and -storen- commands can be used to pull out pieces of a student's response. The -storea- and -store- commands allow the student to specify alphanumeric or numeric parameters. There are -ansv-, -wrongv-, -ansu-, and -wrongu-, aided by “define student”, for judging numerical and algebraic responses. The -exact- and -exactc- commands can be used when it is important that the response take a particular precise form. The -specscommand permits you to exercise various options associated with these commands and also provides a convenient marker of centralized postjudging processing. The regular -judge- command offers additional control over the judging process.

The construction of randomized drills using -setperm-, -randp-, -remove-, and -modperm- (and featuring the conditional commands -answerc- and -wrongc-) was also illustrated in this chapter.

It is hoped that you will read over this chapter occasionally in the course of writing curriculum materials. The TUTOR judging capabilities are extremely rich (because of the wide range of student responses that must be handled in order for lesson material to be successful). Reread appropriate sections of this chapter at a later time, when you need the details. For now it is sufficient to know what is available, and roughly in what form. You may find it helpful to think of the judging commands introduced in this chapter as making up two major classes: those used for handling words and sentences (-answer-, -answerc-, -list-, -concept-, -vocabs-, -match-, -storen-, -storea-, and -exact-), and those used for handling numbers and algebraic expressions (-ansv-, -define-, -ansu-, -store-, and -storeu-).

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