Classic Computer Magazine Archive COMPUTE! ISSUE 95 / APRIL 1988 / PAGE 80

States And Capitals

Elmer Larsen and M.D. Perry, Jr.

This educational game makes learning fun. There are three ways to play, each a variation that's just right for any member of the family. A color/graphics adapter or equivalent hardware is required, along with BASICA for the PC or GW-BASIC for compatibles.

If you think geography is boring, wait until you start playing "States and Capitals." After a few minutes you'll be hooked. And best of all, you'll be learning something about the U.S. With variations that allow you to work on states, capitals, or both states and capitals, this game can entertain and educate children and adults.

Getting Started

Since States and Capitals is written entirely in BASIC, type it in, save a copy to disk, and type RUN. The first thing you'll see is the main menu, which lists the playing options.

You can guess states only, capitals only, or combine the two and guess both states and capitals. Let's say, for example, that you choose the Capitals option from the menu. After making your selection, you'll see a green map of the continental U.S. with each state's borders clearly marked and the state with the first mystery capital highlighted in red. Below the map is a sentence informing you of which state has been selected and asking you to name its capital.

Simply type in the name of the state's capital at the prompt. Since States and Capitals is not case sensitive, you can type your answers either in upper- or lowercase. If your answer is correct, the program responds with a RIGHT! and changes the state's color to brown. If you're wrong, the computer gives you the correct answer, returns the state's color to green, and remembers the state so it can ask you the capital again later.

The game continues in this fashion until you've answered every capital correctly and every state on the map is colored brown. When you finish, you have the option of playing again or returning to BASIC.

The States-only version of the game is like Capitals. One by one, each state is highlighted on the map with red, and you're asked its name. If you answer correctly, the state's color changes to brown, and you continue. If you're incorrect, you'll get another chance later.

For the States and Capitals version of the game, you must identify both the state and the capital to win the state. Please note that in this and the other variations, spelling is important. We should also note that States and Capitals doesn't accept abbreviations. St. Paul, for example, must be spelled as Saint Paul, and South Dakota must include the full spelling, not S. for South.

Program Notes

The section of States and Capitals that draws the map of the U.S (lines 130–800) is from Icons and Images: A Graphics Collection for the IBM PC and PCjr, (available from COMPUTE! Books). This routine creates a realistic representation of the continental U.S., with each state's boundary accurately outlined.

The information on each state and capital is stored in four arrays of 48 elements each. This information includes the x and y coordinates of a point within the state for the PAINT command, the name of the state, and the capital. The arrays are filled by simply READing the DATA statements that begin in line 840.

"States And Capitals," an educational game for the whole family.

States and Capitals uses the random number generator to obtain each state's index number. As a player correctly identifies each state or capital, or both (depending on the variation of the game being played), the state is removed from the array and the number of states available decreases by one. This prevents a state from being selected a second time after the state has been correctly identified. When the number of states reaches 0, all states have been correctly identified and the game is over.

States and Capitals

For instructions on entering this program, please refer to "COMPUTE!'s Guide to Typing In Programs" elsewhere in this issue.