Robopuppy ReduxAn interactive fiction by J.D. Clemens (2007) - the Inform 7 source text | |
| Home page Contents Previous Next Complete text | Chapter 2 - Learning and performing
Section A - Learning The command repository is a room. Ten commands are in the command repository. Learning is an action applying to one topic. Understand "learn to [text]" as learning. Check learning: if Robopuppy is not visible, say "Robopuppy isn't here." instead. Check learning: if the number of blank commands in the command repository is 0, say "Robopuppy's memory is full. You will have to erase a command before he can learn more." instead. Check learning: if the number of characters in the topic understood is 0, say "You'll have to tell him what to learn." instead. Check learning: if the learning flag is true, say "You're already teaching Robopuppy." instead. Check learning: if Robopuppy is scripted, say "Robopuppy is currently performing a command." instead. Carry out learning: change the important object to the i6-nothing; change the current command to a random blank command; now the current command is nonblank; change the message of the current command to the topic understood; change the learning flag to true; change the command index to 1. Report learning: say "Robopuppy begins watching you intently." Graduating is an action applying to nothing. Understand "stop learning" or "end learning" as graduating. Check graduating: if the learning flag is false, say "Robopuppy isn't learning a command right now." instead. Carry out graduating: now the player is not recorded; change the learning flag to false; if the important object is not the i6-nothing begin; repeat through the table of stored commands begin; if the command entry is the current command begin; if the noun part of the undertaking entry is the important object, change the noun part of the undertaking entry to the placeholder object; if the second noun part of the undertaking entry is the important object, change the second noun part of the undertaking entry to the placeholder object; end if; end repeat; end if. Report graduating: say "Robopuppy stops watching you and settles down." [ Make an action "unteachable" to prevent it being stored. ] Graduating is unteachable. Learning is unteachable. |