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, smaller image), to jump to the description of that element. Or just scroll down and read everything in order...
 
Contents:

1.Game Board
2.Nibbler
3.Pills
4.Walls

Arrow Btns
6.Up
7.Left
8.Down
9.Right

10.Score
11.Reset

12.Command Line
  All Commands
13.DoIt Btn

14.ScriptList
15.DoAllBtn
16.Save Btn
17.ReloadBtn
18.LogInBtn
19.Welcome

20. RevDate
21. Pending Nib Steps
22. Repeat Stack
23. Variables
24. Ro/Co #s

Logging In
LostPassword

Expert User

ChompImage
Nibbler Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Pills Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls Walls LogIn Reload Save DoAll Reset Score Welcome Up Left Down Right RevDate NibPend RptStk VarVals RoCoNos RoCoNos RoCoNos RoCoNos RoCoNos RoCoNos RoCoNos DoIt Command Game Script
 

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.
 

2. Nibbler

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.

When you attain the "expert" skill level, the nibbler is drawn a more fiery orange to remind you that you have extra strength.

The nibbler is pretty slow, but you can use the fast command (up to four times) to make the nibbler go faster.
 

3. Pills

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.
 

4. Walls

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.

When you attain the "expert" skill level, you will be able to punch through the walls to access pills locked behind those walls (but try not to go too fast).
 

Arrow Btns

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 the script. For more information, see the Chomp Commands page.
 

6. Up

The Up button moves the nibbler toward the top of the screen.
 

7. Left

The Left button moves the nibbler to the left, toward the listing and away from the score and the buttons.
 

8. Down

The Down button moves the nibbler down toward your keyboard and away from the top of the screen.
 

9. Right

The Right button moves the nibbler to the right, toward the score and the buttons and away from the listing.
 

10. Score

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.
 

11. Reset

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.

If you have variables, the Reset button, or a reset command at the beginning of your script will clear them all to zeros.
 

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. Some commands result in one or more lines of script being skipped over; this usually happens faster than you can see, but once in a while you will see a line hilited in light gray when it is being skipped. For more information on skipping lines of your script, see the "Sequence Control" section of the Chomp Commands page.

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.

Once you start using line numbers to enter your script out of order, it will no longer verify that the sequence makes sense and annoy you with warnings. When you run the script successfully (using the DoAll button), or click on the Reset button, additional lines of script (added to the end, without using line numbers) will resume checking sequence again.

Some commands (notably Repeat and If/Else) control whether the following lines are executed. It is customary to indent the lines so controlled, and many programming development environments (including Chomp) do that automatically for you. Nested structures will indent farther, up to the limit imposed by the panel width.
 

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.
 

16. Save

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. If you 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. To save multiple versions of your program (or multiple copies, in case you mess one of them up), see User Name below.
 

17. Reload

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. You can save multiple versions of your program (or multiple copies, in case you mess one of them up), see User Name below. Reload always reloads the most recent saved copy from whatever account you are logged into.
 

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.
 

19. Welcome

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 this works.
 

20. Version Date

I may improve (or fix bugs in) the website from time to time. Besides the date on the web page itself, there is also a revision date on the top-right corner of the game board.
 

21. Pending Nibbler Steps

As you advance through this course, more information becomes useful and will be shown in small numbers around the edge of the game board. You probably noticed that you can click ahead of the nibbler's motion, and it will catch up when it gets there.
The right bottom edge shows the pending steps currently queued up. The numbers start with 0 for the right arrow, and increase clockwise around the arrow block to 3 for up. From the command line you can tell it to face in a direction but not move at all; these are shown in the pending steps as larger numbers.
 

22. Repeat Stack

An important part of controlling the computer is telling it to do the same thing several times in what is called a "loop." You can nest these loops, and the computer keeps track of how many repetitions are remaining at each level, and what line number that repetition restarts at, two tiny numbers separated by a slant. These are shown in the lower left corner so you know what is happening.

Another part of controlling the computer is telling it when to do something or not in what is called a "conditional." Although you can only skip one step, if that skipped step is another conditional or if it begins a loop, the whole loop or conditional is skipped. This program keeps track of outstanding conditionals as small negative numbers in the repeat stack.

For an example with explanation, see "What You Can Tell the Computer to Do" in the main tutorial. For more information see also the "Sequence Control" section of the Chomp Commands page.
 

23. Variable Values

This game engine lets you define variables, which are letters that stand for a number that you can change under program control. You have 26 one-letter variable names to work with, and they are shown at the left end of the top edge of the game board, but only if you put something into one of them, and only from A to whatever is the highest letter you actually set. A will be on the left end, and they are grouped into blocks of eight (A-G, H-O, P-W, X-Z),  to make it easier to count over to the variable you are interested in.
 

24. Row & Column Numbers

The next phase in game control is to design your own game board. It's easier to see what you are doing with the rows and columns numbered, because you will use those numbers to tell Chomp where to put the walls and pills. For more information, see the "Build Maze" section of the Chomp Commands page.
 

Expert Users

Chomp maintains for each user a "Skill level" (which eventually we'll try to set graded exercises and helps for). You can control your own skill level using the "skill" from the entry box. Otherwise it is retained as a local cookie on the computer you are using, and in each private user name account where you store your scripts. Local cookies disappear when you close the browser, but as soon as you access a saved script on the server, it will also restore your skill level.

Once you have advanced past Chomp into the Java section of this website, your skill level is set to 64 (or higher), and a link to the page index shows up at the top of the entry page.

At a lower level, if your script succeeds in running a maze to the end without hitting any walls and you also score more than 99, you will be deemed "Expert" (+8) and the nibbler will turn orange, which gives it the power to batter down walls. As "expert" you should be able to figure out how to do that, right? Or ask somebody.

Your current skill level is: 0
 

Logging In

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:

UnameLogMeInNewU
 

User Name

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.
 

New User

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.
 

(entry box)

Then type in your chosen user name in the box and click Log Me In.
 

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.
 

Lost Password

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?

Tom Pittman
 

Rev. 2020 February 25