Modifying the Response: -bump- and -put-
It is possible to delete characters from the judging copy of the student's response by using the -bump- command:
This -answer- will be matched if the student types “33 aardvarks” because the -bump- command reduces the judging copy of the response to “ rdvrk.” The original response is not altered and can•be recovered with a “judge rejudge”. Also, the screen display is unaffected: the student still sees “33 aardvarks” on the screen just as he or she typed it. On the other hand, all judging commands following the -bump- are affected since they all operate on the judging copy (not on the original response). For example, a -storea- following the -bump- would give you “rdvrk”. Here is another example:
Note that “cfirst” is the number of characters (including hidden charac- ters such as shift characters) in the original response, whereas “csecond” is the number of characters after the -bump- has removed the vowels. This is a true count since “jcount” always has an up-to-date character count of the judging copy, as influenced by -bump- and related opera- tions. (You may recall that “specs bumpshift” also affects “jcount” by removing shift characters.) Suppose the student types “Apples taste funnier”. In this case, the student will get the reply:
The reason that the word “Apples” turns into “Ppls” with a capital “P” is that a capital “A” is really a shift character followed by a lower-case “a”. With the “a” bumped out, the shift character stands next to the “p”, making a capital “P”.
While the -bump- command will delete characters, the -put- command will change particular strings of characters:
All occurrences of “cat” change into “dog”, and all occurrences of “rat” change into “mouse”. Suppose the student types “Scattered cats scratch rats”. The reply will be “Sdogtered dogs scmousech mouses”!
Both -bump- and -put- are judging commands. They operate on the student's response. Like all judging commands, they stop processing when encountered during the processing of regular commands. The -putcommand has a property similar to -store- in that it can terminate judging with a “no” judgment if it cannot handle the student's response:
If the student has many “cats” in his or her response, the -put- may cause “jcount” to exceed the 150-character response limit. In this case, it changes to the regular state, and the student gets the message “Too many cats!” This regular -write- command normally is skipped, since we're in the judging state.
The following is an equivalent form of -put- which is often easier to read:
All three of these statements are equivalent. The -putd- (d for delimiter) takes the first character as the delimiter between the two character strings. Other examples of its use are:
It is also possible to change variable character strings by using -putv- (v for variable):
When you combine -put- and -bump- commands, you must be careful about how you arrange them. For example, the following sequence is nonsense:
With all a's bumped the -put- will not find any cat's. Similar remarks apply to sequences of -put- commands.
The -bump- command looks for single characters, so “bump B” will not merely bump capital B's. All shift characters will be bumped as well as lower-case b's. In other words, “bump B” is really “bump shift-b”. If you want to eliminate only capital B's, use “putd /B//”. This will find occurrences of the string of characters “shift-b” and replace this string with a zero-length string, thus deleting the B.
The main purpose of -bump- and -put- is to make minor modifica- tions to the student's response and convert it into a form which can be handled by standard judging commands. For example, the word-oriented judging commands (-answer-, -match-, -concept-, etc.) cannot find pieces of words. Suppose that for some reason you need to look for the fragment “elect”, and you don't care whether this appears in the word “selection” or “electronics” or “electoral”. Do this:
The -putd- is used here to put spaces before and after the string “elect” so that it stands out as a separate word. You could also use the values of “jcount” before and after executing the -putd- to determine whether “elect” was present. The number of times it appeared could also be determined from these values. The value of “jcount” will increase by two for each insertion of two extra spaces.