The magazine of the Melbourne PC User Group
QBASIC and the Math Code Puzzle
Keith Phillips |
|
"Math code" puzzles in "The Age" through December and January, can be solved
by a combination of arithmetic, spelling and guesswork.
MATHCODE.BAS is an aid to solving these puzzles and it is made by editing QB&MOUSE.BAS from PC Update November 2000. Copy
QBASIC.EXE, QBASIC.HLP and QB&MOUSE.BAS to a floppy disk. Decide later whether to copy the programs to
another drive.
Go to the MS-DOS prompt and type A: to make it the default drive. Type QBASIC to start QBASIC.EXE, load
QB&MOUSE.BAS and edit the values in CALL MouseLimits and replace all the subroutines with the code in MATHCODE.1. Save the program as MATHCODE.BAS and close QBASIC.
|

Figure 1
|
Still at the A: prompt type QBASIC /ED to start QBASIC as a
text editor. Type in the text from MATHCODE.TXT (Figure. 1). The letters and numbers must be arranged exactly
as shown. All the letters and numbers are in the 1st, 3rd, 5th, etc. columns. To type in the line characters,
hold down the Alt key, press four digits on the Num Pad, then release the Alt key.
Press 0196 for the horizontal line character, 0218 for the corner character and 0179 for the vertical line
character. Print one of each character then use copy and paste. Save the text as MATHCODE.TXT and close the
QBASIC editor. |
Type EXIT to return to Windows9x, and as described for
QB&MOUSE.BAS, make a shortcut, rename it SOLVE MATHCODE, and edit the Cmd-line to:
A:\QBASIC.EXE /RUN A:\MATHCODE.BAS
Make another shortcut, rename it EDIT MATHCODE, and edit the Cmd-line to:
A:\QBASIC.EXE /ED A:\MATHCODE.TXT
Check that the "working directories" of both shortcuts are
A:\.
Double left click the SOLVE MATHCODE shortcut. The first step to solve the puzzle is to Single Left Click
each of the letters O & I in Row 2 to replace them with their number values in the puzzle. The 4th
subtraction in Row 10 shows that F=0. Left Drag F from the puzzle, drop it in Row 2 above the zero and Single
Left Click the letter. The screen image (Figure. 2) shows the puzzle at this stage. Then follow the rest of
the steps in the screen image. As each letter is solved, Left Drag it from the puzzle to Row 2 and Single
Left Click it.
|

Figure 2
|
In Rows 10 & 13 The 1st subtractions include carry, and the equations in the screen image show how these
are recorded. When the result of a subtraction is zero the program automatically inserts the minus one if a
carry is required but when the result is not zero you have to decide whether a carry has occurred. No letters
are solved by the Row 10 & 13 equations but the letter sequences are AV & UR and the only other
letters are E, S & T. The puzzle is solved! You can usually guess the solution to a puzzle without
solving all the letters. There have been a few puzzles where the clues had only nine letters so you also had
to guess the missing letter.
The rest of the equations in the screen image are included as examples. In 6*R=???0, the 6 is the 2nd digit
in the quotient and the R is the 3rd letter in the denominator. Their product in Row 12 ends with zero, so R
must be 5. The last equation shows how to record a subtraction with borrow.
When you are solving a puzzle you can make your own notes but keep them as brief as possible. To make a note
for a subtraction, Right Drag from a horizontal line character in Row 10, 13 or 16. The program automatically
prints the equation with its Row & Eqn numbers. If this is sufficient for your record, just press enter
to hide the text cursor and reactivate the mouse cursor. Or, you can type something, e.g. F=0, and then press
enter. To make notes for the steps that don't use subtractions, Right Drag a space, type your note and press
enter.
If you drop the letter above the wrong number, Left Drag a space to blank it out. If you drop a letter above
the wrong number and Single Left Click it before you notice the mistake, Single Left Click the number to undo
the mistake. At any stage, Double Left Click anywhere to check the result. Single Right Click in Row 6 to
renew the data and start again. Double Right Click anywhere or press Esc to close the program.
|

Figure 3
|
TWOWORDS.TXT (Figure. 3) is another Math Code puzzle. The slash
character means that the solution is two words with 4/6 letters. Double Left Click the EDIT MATHCODE shortcut
and edit the letters for this puzzle. Be careful to over type and don't alter the arrangement. Always save
the puzzle as MATHCODE.TXT because that is the file that MATHCODE.BAS opens.
MATHCODE.BAS is on the BBS in MATHCODE.ZIP which also contains the solution to the two words puzzle. If you
copy the MATHCODE and QBASIC files to another drive, they don't have to go to the same directory (N.B. put
only one copy of QBASIC on your hard drives). Make new shortcuts on the desktop or in any other
directory.
|
Reprinted from the December 2000 issue of PC Update, the
magazine of Melbourne PC User Group, Australia
|