Delphi For Fun Newsletter #26



Monday  April 29, 2002
Delphi For Fun Newsletter #26
I've  worked my way down to the "Send DFF Newsletter" task, after other higher priority spring time jobs like:  "prune fruit trees",  "change oil in tractor, tiller &  lawnmower",  "work-up garden", "put up electric fence to keep deer out of blueberries", and "kill a gobbler".    All completed except the last.   Most every spring, feeling pretty smart,  it's a humbling experience to be outwitted by a bird with a brain the size of a pea.   Says something for specialization of brain function I guess.  I may not be able to see or hear as keenly as Mr. Turkey, but I'll take him on in a programming contest anytime.           
Here are the "What's New"  items  for the last six weeks:

March 16, 2002:  

Arrange the 10 tiles shown into a 5 X 5 array of numbers in such a way that the 5-digit horizontal numbers match the 5-digit vertical numbers.    Not a trivial task, unless you have this Mensa Tiles program.   Implementing a puzzle type  from  the "Mensa Number Puzzles" book, this program allows user play as well as solving puzzles by exhaustive search.    You can also enter and save your own versions of puzzles.   

Documenting this program brought to mind  an article: "Learn to Program in 10 Years".  I'll dig it out and provide the reference one of these days, but the gist of it is that programming is not a skill that can be mastered in 24 hours or 21 days as many book titles would imply.   On the other hand, maybe there are only a few dozen tricks/techniques that, once learned, move you a long way down the road.  A number of them occur in this program.  

March 20, 2002: We'll be doing grandkid things for the next week or so, so I may not have much time to post new programs.  Here is one that represents  a rather startling new voice recognition technology.   I had originally  planned to post this in a week or 10 days, but I'll do it now while I think of it.   It's called  Card Trick to throw would-be cyber thieves off the track. 

I had some feedback from Dan Thomasson this week.  Dan had  stumbled on my Knight's Tour program and happens to run a Knight's Tour site at    If you want  more in-depth knowledge,  check it out. 

There is a new beginner's Delphi programming class starting over at   It may be worth spending some time there, if you can tolerate the irritating pop-up ads.  Personally, I can stand it only for a few minutes - about the third time I get interrupted while trying to concentrate, I'm gone.   What a shame.  

On a typical day, we get 500-1000 hits on all pages, many  from search engine crawlers  I'm sure.   There are usually a half-dozen or so page errors reported, sometimes obvious typing errors, sometimes not.   If you get any "Page not found" or other errors while browsing around here that are not the result of your typing,   please use the feedback link to let me know.  I'll fix any I can track down.  

March 30, 2002:  Back from travels, including that harrowing trip up I-95 interstate through New Jersey, New York and Connecticut.  If you only care to exceed the posted speeds by 10 mph, you had better stay in the slow lane.    No new programs this week but, since tomorrow is Easter, I resurrected this Easter Dates program.  (The devil made me say that.)   It calculates dates of Easter for any year in the Gregorian calendar, and gives a little history of how the dates are determined.   


April 8, 2002:  Here's the last version of Hangman: Hangman 2 - The Tricky Hangman.  It adds a dictionary and computer play to the earlier version.  The program plays the role of Convict about the same way as humans - it just does it better.   As Hangman, the program selects a random word from the dictionary and scores Convict responses.  The "Tricky"  Hangman may bend the rules just a little (but only to ensure that justice is served).   


April 10, 2002: 

I posted  a demo today over in Delphi Techniques showing how to include  Animated Cursors in Program Resource files.    I haven't figured out how to use animated cursors on Web pages yet though -  probably a blessing in disguise.  

April 14, 2002:  Here's the link to the interesting online article, "Learn to Program in 10 Years",    that I  mentioned a few weeks ago.   Just ran across the reference  so thought I had better post it before it disappeared again.   

April  21, 2002:  This week we're beginning the investigation of a fairly major topic in the world of Computational Game Theory:  minimax search of game trees.  Minimax is a technique for finding good moves for a large class of two player games.   Today's  implementation is NIM, a simple  game that meets the minimax criteria.   Players alternate removing 1, 2, or 3 sticks from a pile; the player taking the last one loses.   Two hundred or so lines of code are enough to get the Delphi programmer started.   Non-programmers are welcome to download and play the executable version, but more interesting games of this type will follow.    

April 24, 2002:  Jerry Pournelle,  of Byte magazine fame,  features a  Book of the Month in each column;  maybe I'll start doing the same.    This month it would definitely be Martin Gardner's The Colossal Book of Mathematics,  W.W.Norton, &  Co., 2001.  It's a collection selected by Gardner of the his 50 best "Mathematical Recreations" columns originally printed in Scientific American magazine.   This is the 17th published anthology of those columns, but if you are going to own only one, this is probably it.   

Chapter 3, "Palindromes: Words and Numbers" led directly to today's program, the third in the T-Shirt series,  T-Shirts #3,   Back of the shirt reads: "The only known non-palindromic integer whose cube is a palindrome"    The number on the front is ???.    Palindromes, by the way,  are numbers  (or words or sentences) that read the same from either end.

April 26, 2002:  I've been doing some housekeeping -  among other things the indices in the Programs section of the site are now in alphabetical order.   I also updated Permutes 1,  a program introducing permutations, the ways that a set of objects or numbers can be arranged.     And the new entry is  Permutes 2  which adds the ability to permute  subsets of a set of numbers,  and combinations, the ways to select subsets if order does not matter.     Permutes 2 also includes and tests the Combo unit, a unit providing a convenient interface for permutation and combination generation.

April 29, 2002:  Here's Nim 2, the multi--pile version of that take away game.   This was originally intended to be an more challenging implementation of the Minimax search technique described last week. But it turns out that there is an even cooler algorithm based on the binary representations of the number of sticks in each pile.  It's good enough to let the computer defeat mere mortals most of the time.   


Gary Darby


"The question in life is not whether you get knocked down. You will. The question is, are you ready to get back up and fight for what you believe in?" -- Dan Quayle
"Your decision to be, have and do something out of ordinary entails facing difficulties that are out of the ordinary as well.  Sometimes your greatest asset is simply your ability to stay with it longer than anyone else."  -- Brian Tracy

To subscribe or unsubscribe from this newsletter, visit
17,325 home page visitors!