Problem Description
The young math
professor noticed one day that this subset of his calculator's
keys could be read as an equation, but not a valid one:
But by exchanging a couple of pairs of numeric keys he could make
the equation valid. Can you find the 2 pairs of keys that he
swapped?
Background & Techniques
Another puzzle from the
Giant Book of Mensa Mind Challenges book. Click on
pairs of keys until a true equation is formed. There
are 1296 ways to swap two pairs of keys, 36 ways for each pair, so
36x36=1296 ways altogether. (There are 9 times 8 (72)
choices for each pair, but since swapping a with b
is identical to swapping b with a and they are both
included in the 72, we must divide by 2, resulting in 36 unique
pair swaps of the 9 keys).
I'll admit that I never did solve the puzzle manually in any
number of swaps. But a search of all 1296 possibilities
although quite time consuming for us, is trivial for the computer.
So in addition to clicking on the keys to swap them, I added a
Solve button for the lazy.
There are about 150 lines of user code in the program, about
half to handle user clicks and half for the solve search
procedure. Function CheckAns checks the keys to see
if the equation is satisfied. The keys themselves are
TButton controls put into an array for easy referencing.
Keys are swapped by simply exchanging their caption and tag values
within the array. I included two standard wave files
in the zipped files, just incase they are missing from a
particular system. "Balloon.wav" is a fairly
unobtrusive error sound when the equation after a swap is false. "Tada.wav"
is the reward for a valid solution.
Running/Exploring the Program
Suggestions for Further Explorations
Are there solutions requiring 3 or more
pair swaps?
|
Created: April 9, 2006
|
Modified:
May 18, 2009 |
|