[Top]
- [Next] - [Previous]Introduction and Conventions
The KAREL Users' Manual is a brief introduction to using the Karel the Robot simulator running nder the MS-DOS operating system. Please feel totally free to experiment and play with the simulator; it has been designed to be easily usable by novices, and there is no way to break it. Learning by experimentat- ion is a good habit to get into when studying computers.
One of the most important rules to remember when using the Karel simulator is: End all commands by pressing the RETURN (or ENTER) key on the keyboard. By pressing the RETURN key at the end of a command, you are telling the simulator that it should immediately perform the command that you just typed. If you accidentally type an incorrect command, and have not yet pressed the RETURN key, use the delete or backspace key to erase the incorrect part of the command and then retype it correctly; when you are finally satisfied that the command is correct, press the return key. Inexperienced simulator users often initially forget to end their commands by pressing the return key; when this happens, the simulator sits there and does nothing until the user finally presses RETURN.
You should also remember that the Panic Button is the CTRL/BREAK key. By holding down the CTRL key while pressing the BREAK key once, the entire simulationwill be aborted, and you will be returned to the MS-DOS operating system prompt, >. You should only rarely have to use the panic button, but it is mentioned here just in case you become confused and want to exit the simulator quickly.
Answering Simulator Requests
Simulator messages come in two flavors: requests for information and simple statements of fact. First, let's look at the following request for information by the simulator and a possible user response. This request is one of the many questions that the simulator must ask you in order to run your program. In this example the user types the command M, and follows it by pressing the return key.
Enter Execution Speed([F]ast, [M]edium, or [S]low)[F]:M
The simulator must know how fast you want it to execute your program, so it asks you to Enter Execution Speed. It then tells you, in parentheses, that it is able to understand three responses: F, M, and S. The simulator also indicates, in the parentheses, that these letters are abbreviations for Fast, Medium, and Slow. This user wanted the execution speed to be medium, so he/she typed an M on the keyboard and then pressed the return key. As a rule, all simulator requests for information end with the colon character. Most simulator requests also have built-in default answers. In this example, the letter [F] in square brackets appears after the list of possible answers in parentheses (just before the final colon). Thus, this request indicates that if you press return without typing any other letter, the execution speed would default to F, just as if you had actually typed an F on the keyboard and then pressed the return key.
Karel's programming language, example programs, and many sample programming tasks are completely described in KAREL the ROBOT: A Gentle Introduction to the Art of Programming, John Wiley & Sons, 1981 & 1994.
In the second type of message, the simulator just wants to tell you something that it considers important for you to know. In this case you are not required to supply the simulator with a command; the simulator wants just a simple acknowledgement telling it that you have read and understood the message that it typed. For example, while it is executing your program, the simulator may send the following message to you:
Karel executed a "turnoff". There were no execution errors.*
In messages such as the one above, the simulator ends its statement of fact with the special * character. Whenever you see a *, it means that you should read the computer typed message and then you should press the return key; this action acknowledges the simulator's statement and causes the simulator to continue. The simulator ignores anything that you type before pressing the return key.
There is a third, infrequently seen, type of simulator message. When the simulator believes that it will take some time to accomplish the action that it is about to perform, it will proceed with its action, but only after first printing a message on your screen telling you what it is doing. When the simulator prints this type of message, it will add a suffix of three dots (...) The following is an example of such a message:
Karel is now hearing your program...
This type of message needs no acknowledgement from you; it is displayed only to show you that the simulator is doing something that may make it pause while accomplishing its current action. When the simulator completes its current action, it will automatically erase the entire three-dot message. Frequently, these types of messages will be displayed and erased so quickly that you will not even have time to read them; don't worry, the simulator will require you to acknowledge all important messages that it wants you to read carefully.
This chapter has emphasized the importance of pressing the return key at the end of each command that you type on the keyboard. It also explained the need to press the return key to acknowledge messages from the simulator.
We have also briefly discussed the two types of interactions between you and the simulator: requests for information and simple statements of fact. Remember that all simulator requests end with the colon character; all statements of fact that must be acknowledged by you end with the asterisk character; and all statements of fact that need not be acknowledged end with the ... characters.
This manual assumes that you have a rudimentary knowledge of the computer's operating system and one text editor. In the following chapters you will be told, in detail, how to operate the Karel simulator. A summary of the most important simulator questions appears in Appendix I.4.
[Top]
- [Next] - [Previous]