ZAHRCON is a modification of the familiar game of HANG-MAN. This article shows you how to write it in BASIC with your ATARI computer.
The game of HANG-MAN has been written for every computer on the market today, but as an educational game it has a major flaw. It rewards the player (child) for failing to guess the word. The kids like to see the little "man" get "hung," especially when the computer enhances this outcome with a special graphics display and noises.
When developing educational games for children, we should save the positive reinforcement for correct behavior. There should not be a reward for wrong answers, especially when deliberate. ZAHRCON attempts to improve on HANG-MAN by rewarding the player for guessing correctly the letters comprising the secret word generated by the computer. Each proper letter helps build an animated "creature," accompanied by special graphics and sound.
Since ZAHRCON is designed for children, some as young as five or six, the letters displayed on the screen should be large and dear. Only one word needs to be displayed at any time, so Graphics Mode 2 is a good choice. Upper case letters with numbers and symbols will be better than lower case, and we will need to redefine some of the symbols into graphics characters that will build the creature.
To redefine a character set, we must decide which characters will not be needed in the program. We must also create our new characters to replace the old ones. Each letter, character, or symbol that is on the screen is made up of 8 bytes. Since each byte is 8 bits, a character occupies an 8 x 8 matrix. If a bit is "on" (set to "1"), the corresponding pixel will be lit on the screen. Next, we must calculate the place in the character set where we will be putting our new characters. Figure 1 illustrates how the character set is place in ROM.
To change the character set, we must first move the character set from ROM into RAM, then replace the old characters with the new ones. In this program, we will replace the character set from the quotation mark to the period. To calculate the RAM location of the first character that will be changed, we multiply its position in the character set by 8. The space, which occupies the first 8 bytes, is counted as the zeroeth position. The exclamation point is the first position, etc. The quotation marks begin with the sixteenth byte of the character set. This is where our new characters will begin. Figure 2 shows the old character set and the new character set that will replace it.
Once we have redefined our characters, we can begin our program. Our menu will offer two choices: to play the game or to end it. By moving the joystick forward and backward, we can move the arrow up or down on the screen. Press the red button on the joystick when the choice has been made.
While the player is deciding whether or not to play, our creature displays some life. The winking and blinking is obtained by changing the character that is used for the creature's eyes. The character that replaces the apostrophe is used for both eyes, the quotation mark has been replaced with the left eye, the slash is now the right eye, and the asterisk is for no eyes. If the red button has not been pressed after a given amount of time, the program will choose one of the three options and PRINT it in the location of both eyes. After another set amount of time, both eyes will appear again on the screen. This same principle is used at the end of the game when the child wins. Even though it doesn't seem like much, this kind of enhancement can make the difference between a mediocre program and a good one.
The game essentially plays like HANG-MAN. The player is rewarded with another part of the creature whenever a letter is guessed that belongs in the secret word. If the child solves the word within a certain number of tries, the creature winks and blinks, and there is a graphics and sound reward.
|CHARACTER||DECIMAL CODE||POSITION IN|
The placement of the characters in the character set does not follow their decimal or ATASCII codes.
|OLD CHARACTER||NEW CHARACTER|
|$||left top ear|
|%||left bottom ear|
|&||left top head|
|(||right top head|
|)||left bottom head|
|+||right bottom head|
|'||neck also part of leg|
|-||right top ear|
|.||right bottom ear|
The character set on the left will be replaced with the character on the right.
by Linda M. SchreiberListing: ZAHRCON.BAS Download