Magic Numbers - M.Loftus (Your Spectrum-Issue 11-Page 69)
This program demonstrates the magical mystery of the ZX Spectrum.
You won't be able to conjure a rabbit out a hat, but you
should be able to dazzle your friends with a clever piece of
number manipulation.
You're asked to choose a number between 60 and 4290. Once
you've typed in the mystery number, the Spectrum generates a five
by five grid of seemingly random numbers. You then have to
choose five numbers; as each number's chosen, the row and
column it comes from are erased from the screen, decreasing the
amount of numbers you have to choose from. When all five numbers
have been chosen from the grid, the Spectrum adds them
together and compares the result to the number you chose at the
outset of the program to see if they're the same. And 'Hey
Presto!' ... they are the same.
To say more of the program's inner workings would spoil all the
fun. See if you can work it out for yourself ...
Line 1 GO SUBs to the subroutine that prints up the instructions for
play on-screen.
Lines 100-110 Ask you to input any integer between 60 and 4290. Line 110
checks that your answer is valid.
Lines 120-280 Print up the grid of numbers on-screen.
Lines 290-480 Ask you to select a number by its index letter. This number is
added to the total number of selected numbers, and the
colour of all the numbers in that row and column are
changed.
Lines 490-620 This routine transfers the number left and totals selected
numbers. Funnily enough, the total always comes out as
your original number ... don't ask me, I'm as stumped as you
probably are!
Lines 1000-1100 This is the subroutine that prints up the instructions for play
on-screen. Line 1090 generates a keyboard 'blip'.
------------------------------------------------------------------------------
TYPE: Utility
COMMENT:
This info file was typed by Jim Grimwood
Downloaded from:
Desert Island Disks -- http://www.image.dk/~frankie/
Maintained by:
Michael Bruhn -- frankie@image.dk