Wednesday December 11, 2002


Delphi For Fun Newsletter #30


Wow!  Has it really been 2 months since the last newsletter?    I guess time really does fly when you're having fun.    Halloween, Thanksgiving and a successful deer season have all come and gone.   We're iced in today, so it's a good time to get caught up and let you occasional visitors see what has been going on.   


I have my new 2.4 ghz P4 up and running -  homebuilt of course.  The Gigabyte GA-8IEXP motherboard has integrated USB 2.0, and Firewire ports as well as sound and networking and onboard RAID so my hard drive is now mirrored for reliability.  Add an ATI Radeon 7500 video card, 512mb of DDR memory, and an extra 40gb drive to go with one I had and it makes a decent system for $600.    To be honest,  the old Celeron 800 was perfectly adequate - but once in while  action is required just so you can start spending your spare time thinking about something else.        


We passed 30,000 home page visitors this week and are averaging about 1000 total website hits per day, mostly search engine referrals to specific topic pages.    I added a  "Top Downloads" link from the home page  a few weeks ago - it's updated weekly and shows a total of about 90,000 downloads in the past 12 months!   Thanks for all of your feedback this past year - it has encouraged me to continue the site for another year.    


Here's  wishing all a Happy Holiday Season!


And may you and the stock market both have better times  in the coming year!



Here are the "What's New"  items since last time:


October 8: 2002:   Here's another little program which solves a puzzle from English recreational mathematician and puzzlist Henry  Ernest  Dudeney.  Find all sets of four digits, [a,b,c,d],  which when formed  into two numbers,  (a, bcd or ab,  cd), have the property that the product contains the same four digits.   I  copied Dudeney's naming and called this program Pierrot's Puzzle.  If you know who or what a Pierrot is,  you are probably either European or into theater.    

October 17, 2002:   One more Dudeney gem before we move on.   100 years ago, puzzleist H. E. Dudeney came up with a way to dissect a square into 4 polygons which can be reassembled to form an equilateral triangle.     Dudeney's Dissection lets you print outlines or partially solved solutions to work on for yourself. 

My first attempt,  shown here,  is not quite up to the job - the triangle formed is isosceles, but not equilateral.   The real solution is not  quite so symmetrical. 

Guess I'd better go get all these paper clippings cleaned up before somebody comes along and delivers more comments about acting my age.    


October 20, 2002:  Here's a little program that lists the largest files on a user selected drive.  I just discovered and deleted 30 mb of disk space in Outlook Express mailbox files left over from a conversion to Outlook several months ago.  Now if I can just figure where that other gigabyte or so of hard drive bloat came from.     List Large Files is available for downloading from a new Utilities programs section

October 26, 2002:

 A little exercise in Computational Geometry was posted in the Delphi Techniques section the other day.   Included are an improved function testing  for line intersection,  and functions to construct a perpendicular from a point to a line and to construct a line through a point on a line at a given angle.    I developed them for use in  Dudeney's Dissection program,  but it seems like they may be handy for any problems which combine computer programming and geometry.  

October 30, 2002:   Here's today's problem and the Expressions 2002 program that solves it:

Insert +(addition) and × (multiplication) operators as required into the string of digits 123456789 to form an expression that evaluates to 2002.  For example, if the desired value were 100,  then one  solution would be 12+34+5×6+7+8+9=100.

This program was prompted by a viewer request.    It is similar to the Expressions100 program which required  + and - operators.   The complication this time is that multiplications must be performed before additions.   The same viewer also posed a much tougher version that's providing more hours of fun - stay tuned.   

November 7, 2002:  

Whew!   Here is the Discrete Event Simulator program - one of those  programs written several years ago that only needed "a little tweaking" to get it ready to post.  That was two weeks ago and has occupied most of my spare time since then.    It simulates "transaction" processing systems that support queuing, including  many of our daily activities from the toll booth to the grocery store to  the gas station, barbershop, and public restroom,  just to name a few.  A big complex topic that I think can be fun to play with, even if you are not a grad student or professor of Mathematics.    Included are several sample cases to give you the idea, and  some simple animation that lets you watch the little customers move through the system. 


November 16, 2002:   I posted a new version of our most popular program, the Roller Coaster Simulator today.  It  includes a few fixes and enhancements.   I've been working with a young man this week who is using the program as the basis for his 6th grade Science Fair project.    Brendan's great  idea is to compare G forces for circular vs. clothoid loops.   (Clothoid loops are elongated vertically and reduce maximum G force on riders by  taking the cart in a flatter curve when it is going fastest  at the bottom of the loop and  more sharply at the top when it's speed is slowest.)     I added G and Distance columns to the Debug tab data display to help him along a little.    While playing with the program, I decided to improve the accuracy when inserting additional control points into a track  (right click the track to enter design mode and drag, insert, or delete control points).   

November 19, 2002: It's been a while since we posted a real beginner's program.  Here's one that solves a puzzle about the size of Mr. MacGregor's Cabbage Patch.   About 5 lines of code solve the problem and  twenty  lines  display the results.    About normal I guess, 20% doing it and 80% talking about it.


November 20, 2002:  Version 2 of GridQuickSort is available over in the Delphi Techniques section.  A user requested the ability to sort integer fields.  This new demo version  adds a "data type" field to QuickSort permitting columns with  alpha, integer or real data to be sorted.

Deer hunting season is upon us (at least here in Virginia), so  email is slightly backed up. If you sent feedback and requested contact, be patient, I'll get there.    Two are in the freezer so far (deer, not emails),  so the pressure is off -  we'll eat well for the next year.  But the hours spent communing with nature are  restorative,  so I'm still going out - just not so much at 5:30 AM, or in the rain, or when the temperature is in the 20's or when the wind is howling.   :>)

Elizabeth - the reply-to address on your feedback is invalid,  Here's a link to the "Geometry Junkyard" which may provide what you need.  If not, please write again.

November 21, 2002:  A young friend sent this "Darby Coaster"  the other day as thanks for helping him a little with his Science Fair project.  Actually, he helped me by finding a couple of bugs in the program,   The coaster is cool but I  believe I'll pass on riding the real thing!    Clicking above will download the coaster  - but if you want to see it run and don't have the program yet, it's available from the Roller Coaster Simulator page.

 Have you ever taken so long to find an  answer that by the time you've found it, you've forgotten the original question?   That's the case with today's Set Partitions page and program over the the Math Topics section.   I'm sure I started the investigation in order to help solve some puzzle, but it became a fascinating study on its own.   A set partition is simply a division of a set of distinct things into subsets.  Generating and counting  them involves a couple  more of those numbers with guy's names attached.  

A 5x5 board that can be solved in 4 moves*

November 24, 2002:  Here is an update to the Token Flip program  - a game whose objective is to make all tokens white by clicking.  Each token clicked will change the color of that token and those above, below, left and right - if they exist.    A viewer had requested boards larger than the original 4x 4.  This version allows boards up to 7x7. however  the "Auto solve" time gets very large very fast.  Some modifications allow this version to solve 5x5 puzzles in a few minutes.  A general 6x6  game,  say one needing   12 moves to solve, would probably take years even on a fast computer.  We really need heuristics to allow trial moves to be selected intelligently.   I've added a button that will allow random boards with few moves to be generated.  If anyone out he there can figure out how to consistently manually  solve say a 5x5 game requiring  8 or more moves in the minimum number of moves - let me know your "rules" for determining how to move.  *(Col 4, Row 1),(C3,R2),(C4,R2),(C4,R4)

November 25, 2002:  The two of us will each take a 52-card deck, shuffle it thoroughly and place our decks face down on the table.  Now we'll start turning cards face up, one from the top of each deck on each turn.  If we go through the entire deck without two identical cards being turned, player A wins.  If an identical pair is turned, player B wins.  Do you want to be player A or B?   

Some knowledge of the mathematics of Derangements  may help you choose.

We're off to a daughter's house to eat some turkey and all that goes with it for the next few days.  If you live in a country that celebrates Thanksgiving, have a good one.  If you live elsewhere, find something to be thankful for anyway, just on general principle.    See you in December!


13 15 11 5
14 16 12 6
11 13 9 3
10 12 8 2

December 4, 2002:  Another Martin Gardner trick this week - select one number form each row and column of the Magic Matrix.  The sum will always be the same!    (The big 40 for the sample at right.) This program will not only generate magic matrices for you, but let you play them and understand why they work.

Freeth's Nephroid

December 6, 2002:  I was browsing Virginia's SOL (Standards of Learning) guidelines the other day and was surprised to see that the Algebra I section has a dozen or so objectives that  specifically require the use of  a graphic calculator.   That prompted me to revisit our SciGraph function graphing program and, of course, ended up fixing a few bugs and making a few enhancements.   Version 1.1 includes help pages with guidelines for writing expressions and previously undocumented  navigation tips.  The mouse can be used to zoom a rectangular area of the chart and to display numeric values of clicked points.  Users are now prompted to save any unsaved chart changes when closing or loading a new chart.   Obviously (to me)  a better choice than a calculator for exploring graphs of functions.   Maybe  if I included  the "Conchoid of Nicomedes", the "Limacon of Pascal", and the "Witch of Agnesi" curves.   Love those names!


December 7, 2002:  A viewer was having trouble saving mazes created with our Maze Generator program.   No wonder -  requests that did not include the  .maz file extension were just  ignored.  That  was rather rude,  but it is fixed now.   Who can find the next bug? 


     Select 1 or more from any row

December 10, 2002:  Here is a new version of our multi-pile NIM program.  It's a good news-bad news story.  The bad news is, that I didn't realize until finished that I had written an earlier version in April!  This growing old business is going to be heck.   The good news is that at least this version has several new features including ¤ token selection by mouse clicks,  ¤ computer vs. human play,  ¤ miseré (last token loses) play,  and  ¤  improved (.i.e. shorter) implementation of the move selection logic using exclusive or (XOR) operations.   



Gary Darby


"Success in solving the problem depends on choosing the right aspect, on attacking the fortress from its accessible side." - George Polya 

"Great people are great because they solve countless, seemingly unsolvable problems;  you can too if you choose to." - Mark Victor Hansen 

"Once you have a clear objective, think and talk only in terms of 'How?'" - Brian Tracy

To subscribe or unsubscribe from this newsletter, visit

 30,050 home page visitors!