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.