Chomp Game Help
This page explains the elements of the Chomp game used in "Control the
Computer". There is a separate page for Chomp Commands.
As you advance through the tutorial, more game programming skills
will be explained, and this help window will describe the new features, so if
you need help, you should always click the "Game Help" link from the page
where the new feature you are trying to use is explained (or from a later page).
Choose a link from the index on the left, or click on an element in this image
(same help, bigger image), to
jump to the description of that element. Or just scroll down and read
everything in order...
1. Game Board
This is where the game is played. It was inspired by the original PacMan
game, but not an exact copy. When you click on an arrow
button in the lower right corner, the nibbler will move in that direction,
eating the pills at it goes, and adding up
your score. The small pills are worth one point,
and the larger pills are worth ten points.
This little fellow slides around the game board in the direction you point
it using the arrow buttons, but to go long distances
you must keep on clicking on the arrow buttons or use
the command line. Use the Reset button
to put the nibbler back where it started.
There are two sizes of pills, the smaller ones are one point each, and
the larger pills, which are harder to get to, are worth ten points each.
Each pill is "eaten" when the nibbler arrives on
top of it. Use the Reset button to put the pills back.
The blue walls prevent the nibbler from going in
certain directions. This layout was inspired by the original PacMan game,
which is probably more interesting as a game, because it's much harder
to program the computer to go eat every pill.
I think the original PacMan game had a joystick, but we mostly don't have
joysticks on our computers, so these buttons will have to do. Depending
on which button you click on, the nibbler will go
one unit distance in that direction. To go long distances you must keep
on clicking on the arrow buttons or use
the command line.
You can click as fast as you like (and the game will remember
how many times you clicked), but the nibbler will only go at its own fixed
speed. If you click on an arrow button when the nibbler is blocked by
a wall in that direction, it won't go anywhere, but
it will turn to face the wall and keep on chomping.
Most of the buttons in the game window have names that can be typed
into the command line and added to
For more information, see the Chomp Commands page.
The Up button moves the nibbler toward the top of
The Left button moves the nibbler to the left, toward
the listing and away from the score
and the buttons.
The Down button moves the nibbler down toward your
keyboard and away from the top of the screen.
The Right button moves the nibbler to the right,
toward the score and the buttons and away from the
The score shows how many points you got from the nibbler
eating pills since the last Reset.
Clicking the refresh icon on your browser also resets the score. If you run
the nibbler off the edge of the game board, or if you accumulate a total score
greater than 999, then the score message changes to "Game Over!" and you must
Reset the game before you can proceed.
Click on the reset button to restart the game from the beginning, with
the nibbler and all the pills
back in their original places and the score restarted
at zero. Unused arrow button click-aheads will be
discarded immediately. If you click on the Reset button and you have a
Script running (from using the DoAll
button) it will be terminated immediately, without finishing, but that
does not happen when you use Reset in the script itself.
If you have a script in the listing
panel, the first reset will leave it there, but clicking reset again will
erase the script too. Use the Save and Reload
buttons to save your script across reset clicks. Clicking the refresh icon
on your browser also resets everything (including the listing) but not
anything you have saved using the Save button.
If you have changed the maze, the second Reset click will also revert
to the default.
If you have attempted a LogIn or asked for a Reload
from the server and it is slow or unresponsive, the Reset button will cancel
the request. If you are using line numbers to enter
your script out of order, they will not be checked for a reasonable sequence
(possibly resulting in a failure when you run the script using
the DoAll button), but Reset resumes checking.
12. Command Line
This is where Real Programmers do their stuff! Type in a command for the
computer (like the name of an arrow button), then
click the DoIt button (or press the Enter key on your
keyboard) and the computer will copy your command to the script listing,
and if it makes sense (like an arrow button) it will
also do it immediately.
Most of the buttons in the game window have names that can be typed
into the command line and added to the script. For
more information, see the Chomp Commands page.
Eventually you will learn commands that can only be run in a script using
the DoAll button in the right panel. Putting these
commands in is called programming.
If you enter the command with a line number, the command will replace
that numbered line of the script. If you type the command without a line
number (or a number beyond the end of the script), it will be assigned the
next number at the end of the script. If you use a fractional number (with
a decimal point), then the line will be inserted between the two lines that
your fractional number is between. If you want to make a minor change to an
existing line, you can type in the line number and the single character '='
instead of a command, and that line from the script will replace the
command line so that you can make the desired modifications before
returning it to the script.
13. Do It Button
The DoIt button looks at whatever command you have typed into
the command line, and if it knows how to do that,
it copies it to the next line of the script.
If you misspell a command, it might try to figure out what you meant and
substitute that. If the command makes sense to do it immediately (like
an arrow button), it does that too. While typing text
into the command line, the "Enter" key on your keyboard has the same effect
as clicking the DoIt button.
14. Script Listing
The script is where you can build a sequence of commands for the computer
to do all at once -- well, actually in sequence -- with no further action
on your part. You type each line of the script in using the command
line and the DoIt button, then you click DoAll
to run your script. Be sure to save your work, so if
something goes wrong -- and it will! -- you can reload
it and continue where you left off at the last save.
When you click the DoAll button, the script is
executed in sequence, one line at a time. The line that is currently active
(or possibly waiting to run) is hilighted in green.
Normally, as you type in commands, they get added to the script in
the order you typed them. However, you can see the lines in the script
are numbered. If you give a line number to the line you are typing, thne
it replaces that (numbered) line in the script. To insert between two lines,
give it a fractional line number -- like "2.5" to place it between lines
2 and 3. The lines will then be renumbered. You can delete a line by typing
in just a line number and nothing else.
15. Do All
If you have a script in the listing
panel, click the DoAll button to run the whole script from top to bottom.
After you have spent the time to type in a large (or small) Script,
you can save your work, then reload it at a later
time. Whenever you save your script, it is stored in a "cookie" on your
computer. Later on you can use
the LogIn button to log into
the server, then your saved script is also saved on the server under whatever
name you used to log in. Be careful, the save button will save whatever
is currently in your script, even if it is empty, and replace whatever
you previously saved.
After you have saved a script,
you can reload it back into the game and run it again, even if you erased
your local copy using the reset button or if you turned
your computer off and came back the next day. Reload
always reloads the most recent saved copy.
18. Log In
(The LogIn button is disabled in the first pages,
until after it has been explained in a later page.)
As you become more skillful programming scripts,
you will want to save
your work, then reload it later. We have a server
which you can give a user name to and it will remember you and let
you save your scripts on the server under that user name. Then later, or
even on a different computer, you can log in and recover your saved script.
This process all starts with the LogIn button,
which is explained in a later page.
Nothing shows in this part of the window unless you have successfully logged
in. If you gave it a complete user name, it will welcome you with (only
the letters at the front of) the name part of the user
name. You can also log into another user's account in read-only mode
to download (Reload) their script if they are willing
to share it, and the Welcome panel will report you as a "Guest" of that
person, but you will not be able to save your scripts to that account.
See the discussion on "User Name" below for how
When you click on the LogIn button, the command line
and DoIt button are hidden and replaced with the log-in
information as you see here:
The first thing you need to do is to think about what user name
to use. You can use any user name you like, but if you choose a name that
resembles your real name, then if something goes badly wrong we will know
it's your data and can fix the problem for you. We will not let somebody
else pretend to be you to mess with your scripts, but for that to work,
you need a verifiable name.
Most computer systems ask for a user name and a password, but this facility
takes just a "name". I suggest you use your real name at the front and
then some really hard to guess letters and numbers and stuff at the end,
separated by the underscore '_' character (shift-hyphen on most keyboards).
For example, I might log in as "Tom_1234#". The game panel will display
it as "Welcome Tom" so anybody looking over your shoulder will see only
your name, but not enough to sneak in and mess with your data. If you try
to log in as "Tom" the server will allow you to see my saved script as
a "Guest" but the save button will be disabled so you cannot change it.
If I did not want you to see my script, I could create another account
"Tom27_8765" and the server would see "Tom27" as a different user, but
the game would only show the name "Tom" (no numerals or special characters)
so anybody looking over my shoulder still cannot guess the full login name.
The server is looking for whatever you chose as a name up to the underscore,
for allowing guests, or disallowing others to use the same name.
For example, if you tried to log in as "Tom27_bleep" the server would
see that it already has a "Tom27_..." and refuse it, but you still could
log in a a guest of "Tom27" (if you knew the extra characters, which do
not show). Is that confusing enough?
The point is that you will probably want to share your masterpiece script
with your friends, so use a nice easy name like "Bill_..." or "DebbiSmith_..."
but put something unique in place of those dots to protect your script
from tampering. Then create another user name like "Bill76_..." or "Debbi$%_.."
where you can store your private scripts.
Spaces and special characters outside the ASCII sequence (like letters
with accents) will be removed from your user name.
Click the New User checkbox to tell the server that you are choosing a
new user name. Be sure it is checked off every time after that, when you
are using the same user name, or if you want to look at a script as a guest
of some other user.
Then type in your chosen user name in the box and click Log
Log Me In
When you click this button, the chosen user name is sent to the server,
and it tells your computer if you are now logged in as the owner of that
account, or a guest, or if you did not succeed at all (it puts up an alert).
If you have an unsaved script, it will not be damaged by login failure.
But you should try to save it locally if you can. When you have successfully
logged into the server, it will show "Welcome" with your name.
Most of us cannot remember everything, so we all forget the passwords --
or at least the exact spelling of a name we invented last week. If you
can remember the part of your user name before the underscore, you can
always log in as a guest to recover the script, then create a new user
name and save what you have there. If you used a reasonable approximation
to your real name and you want to keep that same basic name, you can come
ask me to fix it, and I can delete the old account, then you can re-establish
it with your new password part. Or if you cannot even remember the part
before the underscore, but I can verify it's you, I can extract the data
for you. But let's try not to do this too often, OK?
Rev. 2020 February 25