Hangman

Steve W. Jackson
sjacksn@mindspring.com

This is a program I built with REALbasic, formerly known as CrossBasic in its shareware incarnation. It's a fairly robust programming environment, somewhat akin to the BASIC programming language from which it derives its name. But trust me -- it's more powerful than any form of BASIC you're likely to have seen before. It's object-oriented (mostly, anyway), and has many similarities to the highly-popular Visual BASIC in the Windows (yuck!) world. But it's not difficult to learn, and in a short time even an inexperienced programmer with the necessary desire and interest can learn to develop useful Macintosh programs. You can try it out for yourself at <http://www.realbasic.com>.

I developed Hangman for fun and to gain experience with REALbasic. It's a fairly simple and straightforward game, but there are a couple things you might want to know in order to get maximum enjoyment from the game.

THE MENUS

About

As you might expect, this is where I get a chance to toot my own horn. It will always reflect the current version and advertise for REALbasic.

File

File->New Game

When you select this option, one of several things will happen. When you start, the Statistics Window (visible or not) records the name of the current player as "New Player." If this is the case when you choose New Game, you'll instead get the New Player dialog to enter your name. If you cancel, the name remains unchanged. After you identify yourself, you'll have to select a word file before play can proceed. If you opt not to choose one, the default file named "Words" is selected for you. After this, New Game will simply start a new game by selecting a new word from its list.

File->New Words File

When you select this option, you'll be able to choose a new file of words from which subsequent words will come when choosing New Game. When you first begin play, if you should cancel this dialog then you'll automatically load the file named Words in the same folder with the Hangman application. On future selections, if you cancel, nothing will change. It's OK to choose this option in the middle of game play. It simply changes the list of words from which your next word will come when choosing New Game from the File menu.

File->New Player

This dialog lets you enter the name of the person playing Hangman. If you're in the middle of a session and want someone else to play, this will put up the new player's name in lights! And it will reset the values on the Statistics Window's "All Games" panel. Also, there's now a popup menu which will let you choose from any known players (based on the contents of the Player Statistics file). So if you've played before, you don't even have to type your name!

File->Quit

As you might imagine, this is how you quit playing when you've passed hours and hours away broadening your vocabulary and having a great time! But you probably won't want to use this option very often.

Edit

No features of the Edit menu are supported in Hangman.

Settings

This menu sets the maximum length of words Hangman will select for you. When you choose 5 or 7, the shortest word will be 2 letters. When set at 9, the shortest words will be 4 letters. If you play with the settings at 15 or 20, the shortest words will be 8 letters long. It's perfectly OK to change this value in the middle of a game. It simply means that all future games will use that setting during your current session.

Statistics

Statistics->Hide Statistics or Statistics->Hide Statistics

This menu is simply a toggle. It begins with "Hide Statistics" showing, which (if selected) will close the Statistics window. If you do this (or if you close the window via its close box), this menu will change to "Show Statistics."

The Statistics window shows the selected player name at the top. It also has a tab panel containing "Current Game" and "All Games" two tabs. The Current Game panel is reset when you begin a new game to show the length of the currently selected word and zeros in the other entries. Each of the other numbers will be updated after each guess. The "All Games" panel will be reset when changing players, and it shows the total number of guesses for the current player, including the count of correct, incorrect, and a winning percentage. The contents of the All Games panel will be saved when switching to another player or quitting the game.

Statistics->View/Delete Statistics

This menu will allow you to see the secret information Hangman collects on every player! :-) Actually, each unique player name used has the contents of the Statistics Window's All Games panel saved. In this dialog, you can see the numbers for all players who've used your copy of Hangman. If you have too much competition, you'll probably want an additional copy. Why not -- it's free! If you should decide you no longer want any player's numbers kept in your file, you may select them and click the Delete button. Note, though, that you cannot delete the statistics for the player whose name is in the Statistics Window at the time. When you've deleted all the statistics records you wish, click the Done button and your "Player Statistics" file will be updated. WARNING -- this cannot be undone. If you delete player statistics and wish to change your mind *before* clicking Done, the only way to do so is to select the Quit item from the File menu (which is the only menu item that's operational while this dialog is showing).

Help

This menu is a Macintosh standard, not provided by me. However, if you turn on balloons, you'll find some helpful hints as to what various controls in the main game window will do. For even more enjoyment, turn on Balloon Help and view the About window!

THE HANGMAN WINDOW

This is where the action takes place! Of course, Hangman just wouldn't be the same without a gallows where Stick Man will risk life and limb on your spelling and vocabulary skills. At the right side you'll see the Current Word field, which will show "-" characters for each letter of the secretly chosen word when you start a game. Each of these will be replaced by the correct letter if and when you guess it. Just below that is the Used Letters list, which will show (in alphabetical order) every letter you've guessed so far for the current game. If you attempt to type a letter from this list into your Guess field, it won't be accepted (there will be a sound to clearly indicate that this keystroke is being rejected).

The important stuff is, of course, the place where you type in letters you wish to guess, and the Guess button to accept them. You can't use the Guess button if you've got nothing in the Guess field. And you can use the return or enter key if you don't want to be mousing around.

Of course, there's audio feedback built into Hangman. You'll hear a "boing" sound for each incorrect guess you make -- meaning that Stick Man is a step closer to his demise! You'll hear another small Harpsichord sound if you type a letter that's already used. If you get the word right, you'll be praised (Yes!). If you get your stick man hung (for shame!), you'll be chided (Rats!). If you should be unfortunate enough to get Stick Man hung before you've even guessed one correct letter, Hangman will respond appropriately -- "Yuck!" But you should strive for the best audio reward of all -- if you should get all the letters right without missing any, you'll be roundly applauded.

OTHER STUFF

If you don't choose a file when first starting a game, Hangman will use "Words" from its own folder. If it isn't found, or if it's empty, the program will display a dialog box to that effect and immediately quit. Likewise, if you do choose a file, and it's empty or another problem arises reading it, Hangman will quit.

The Words file provided contains over 37,500 words. I borrowed it from a crossword puzzle game I had around, and I can't vouch for the "friendliness" of some of the words (although I have removed some questionable words and some alternate spellings). But it can be edited freely, or substituted with one of your choosing -- provided the format is as required. In addition, I borrowed two other smaller files (Kids Words and Strategic Words) from that same game and provided them so that you can experiment if you like.

Hangman will read the selected file and build an internal list of words from which it randomly selects for each game. The large Words file provided means the program needs to be set to a fairly large RAM allocation. I've tried it with too little RAM allocated and it locks up my whole machine! Experiment with other memory settings at your own peril.

There is one known bug: if you use a file in which all the words are longer than the selected setting, the program will enter a permanent loop when selecting random words. However, I've built in a capability to let you use Command-. (that's command-period) to terminate the program if that should ever happen.

If you should decide at any time that you no longer want to keep any of the statistics in the "Player Statistics" file, you can either delete all of them via the program's dialog, or simply delete the file -- Hangman will recreate it as required.

LEGAL STUFF

This game is "Feedback-Ware" -- I did it for fun, and I'm not asking for any money or other valuables, not even the postage for a postcard. I simply ask that you enjoy it and send me feedback. Send me an email, tell me you found my Hangman game, tell me when, where, what version, and tell me what you think of it. How do you think I could make it better? Did you find a bug?

That's it -- just your feedback, good or bad. And tell others about it if you like it. Or let me know what other games, utilities, or useful goodies you think would be interesting so that I can have more ideas for developing (more) useful Mac programs with REALbasic.

= Steve =
sjacksn@mindspring.com

Version History

1.0 -- Initial release of Hangman

1.1 -- Minor interface improvements made as I continue to learn more about REALbasic. Most notably, I made some color adjustments, fine-tuned the placements and sizes of all windows and controls, and added the Player Name and New Player features.

1.2 -- A few additional interface tweaks (probably not noticeable to most people, but then I'm not most people). Added the ability to choose from a number of available text files.

1.3 -- Added Player Statistics and a dialog for viewing/deleting them. Fixed a problem where the New Game option had to be selected twice if a player name hadn't been entered yet.

1.3.1 -- Added a popup menu to the New Player dialog to allow choosing from available players with stored statistics. Also reworked the color combinations in the statistics window in an effort to reduce the flashing of the background color when updating numbers in the statistics tab panels.

1.3.2 -- Worked further on the New Player dialog to make sure that the current player's name was included on the popup menu even if it hadn't been found in the statistics file. Managed to tone down the RAM requirements just a bit -- but it's still wise to be careful if you experiment further with this setting.

1.3.3 -- Recompiled with REALbasic 1.1.1 to insure that any included bug fixes were incorporated into Hangman.

27 March 1999 -- no version change. I worked a bit on this Readme file to include some window and menu pictures to better illustrate Hangman.


Original file name: Hangman 1.3.3 Readme - converted on Sunday, 26 December 1999, 18:44

This page was created using TextToHTML. TextToHTML is a free software for Macintosh and is (c) 1995,1996 by Kris Coppieters