As of October, 2016, Embarcadero is offering a free release
of Delphi (Delphi
10.1 Berlin Starter Edition ). There
are a few restrictions, but it is a welcome step toward making
more programmers aware of the joys of Delphi. They do say
"Offer may be withdrawn at any time", so don't delay if you want
to check it out. Please use the
link to let me know if the link stops working.
Support DFF - Shop
If you shop at Amazon anyway, consider using
this link. We receive a few cents from each purchase.
Support DFF - Donate
If you benefit from the website, in terms of
knowledge, entertainment value, or something otherwise useful,
consider making a donation via PayPal to help defray the
costs. (No PayPal account necessary to donate via credit
card.) Transaction is secure.
e-mail with your comments about this program (or anything else).
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
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
Created: April 9, 2006
February 18, 2016