home *** CD-ROM | disk | FTP | other *** search
- MISSING LETTERS
-
- by Captain COMAL
-
- Many people are not aware of the
- handy string search facility built
- into all versions of COMAL. This is
- accomplished with the keyword IN.
- This missing letter puzzle program
- demonstrates how easy this is. The
- program is a complete puzzle system,
- including routines to create the file
- needed as well as read back and
- display the puzzle text.
-
- The program checks the disk status
- after the puzzle file is opened. If
- the status is not "00" (for OK) the
- create procedure is executed. This
- could be modified to check only for
- status "62" (file not found). As
- listed, any error sends you to the
- create file routine which inputs text
- you type in (up to 39 letters) and
- writes it to the puzzle data file. It
- counts the entries as you go. Hit
- RETURN on a blank line to stop. For
- example, you might type:
-
- Programmer's Paradise Package
-
- Playing the game consists of several
- steps. First it reads a random number
- of text lines from the file. It knows
- exactly how many are in the file from
- the variable COUNT. Next it prints
- the text on the screen, replacing
- some of the letters with a dash (-).
- Finally, it allows the player to type
- in the entire text message (incorrect
- letters are ignored). I have included
- an example RUN about half way through
- the puzzle immediately after the
- program listing.
-
- You can customize and expand this
- program to fit your needs. Try
- changing the letters the program
- hides with a dash (see line 550). It
- looks for the vowels now. Replace the
- "aeiou" with any other letters. Or
- even make it a variable - just add
- line 545 and change line 550. For
- example:
-
- 0545 input "Letters to hide: ":hide$
- 0550 if text$(letter) in hide$ then
-
- Then, in COMAL 0.14, remember to DIM
- the variable HIDE$ at the top of the
- program:
-
- 0045 dim hide$ of 26
-