January 8, 2011

Delphi For
Fun Newsletter #58 **
**

Welcome to 2011!

September 2010 passed without noticing that it marked the 10th anniversary of DFF! It has been a good run and I have had a lot of fun creating the programs contained here. My biggest disappointment is that Delphi has not been made more available at a reasonable price for students and hobbyists. Perhaps Lazarus, a "Delphi-like" interface for FPC (Free Pascal Compiler) is the best hope for the future. I plan to revisit it this year and perhaps start publishing Lazarus versions of the current DFF program set.

On the home front, we plan to spend more time with family this year and to continue working while we can on our "bucket list" of places to visit.

Here's a summary of the new and changed programs since the last newsletter.

---------------------------------------------------------------------------------

**September 6, 2010: ** "Make this sentence true by
filling the blanks with number words: ___ T's, ___ N's and ____ vowels."
This is an example of a problem solved by today's program
Self Describing Sentences. (Try "ten", "ten", and "twenty-four" as a solution to this
example.)

**September 11, 2010:** I've never had reason to do
much with "Date" arithmetic. Delphi's date-time structure encodes time as
days and fractions of days from some long ago reference date and there are
formatting routines that display them in various readable formats. Moving
forward or backward in time by "Days" units is a trivial operation, however
allowing increments to be "Years" or "Months" makes the problem interesting.
Here's my Date Calculator program which
emulates the one introduced with Windows 7 with a few unexplained differences.

**September 12, 2010: ** "Dice Probabilities"
in our Mathematics section is now about 5 years old and still gets occasional feedback.
Dice Probabilities, Version 4
posted today corrects a "problem" for anyone interested in the odds for the 5
dice version of Poker. I had included "full house" (one pair plus
3-of-a-kind) as one of the probabilities listed but neglected to exclude those outcomes
from the "one" pair and "3-of-a-kind" categories. They are now
excluded, leaving room to count the 3% of rolls that are "straights" and the 6%
that have no poker value making the probabilities now sum to 100%.

**September 30, 2010:**
Play MP3 Version 2 is a
major rewrite of the original version posted in our Delphi Techniques section.
Like the first version, it plays an audio file based on a user click, but
the association of the click location with the file to be played is based on
text enclosed in parentheses within the sentence rather than on the location of
the sentence within the text. The new technique, written at a user's
request would simplify future maintenance if the text were to be modified.

**
September
21 2010:** I have been tied up with a small commercial project for the
past week or two with no time for the playtime projects. I did take a
couple of hours yesterday to dress up a puzzle project written a few years ago.
Digit trees, Version 2 adds a "Hint" button
to help find a solution. The task is to drag digits 1 through 9 to the target
circles so that each circle contains the sum of the circles connected to it from
below. If you like bargains, did notice that there are several copies
of this puzzle's source book on sale for under $5 shipped at Giant
Book of Mensa Mind Challenges! A great gift for yourself, a child, or
grandchild.

**October 5, 2010:** Over 3 years since the last fix to
our popular "CutList" program.
CutList Version 3.4.2
corrects a problem which could occur if the user tried to load a "txtHI" file,
(user manually created solution) without loading the original base case file
first. The situation was not diagnosed and the loading errors got ugly.
I believe it's diagnosed better now, but I haven't done a lot of testing on the
fix so, as usual, let me know if you find problems (old or new).

**October 14, 2010: **Spellbound, a word search helper was
added to our Wordstuff program wrapper
today. Spellbound searches a set of letters to find all embedded
words. It can also generate random scrambled 7 letter word sets as
practice material. I wrote Spellbound to help improve my scores when
playing
this online game of the same name . (And because implementing search
strategies is one of my favorite hobbies.)

**October 26, 2010:** I've been busy getting ready for
winter and deer hunting season for the past week or so, but did find time
on the rainy days to have some fun with fuel level calculations based on it's
depth in our 275 gallon tank. The Fuel Tank
Capacity program posted today emulates the charts that are available online
for several standard sized and shaped fuel tanks. There are a few
anomalies in the online charts but either source confirms that the 13" of diesel
fuel in my tank translates to 70 gallons, hopefully enough to see the tractor through its
snow plowing duties this winter.

**November 4, 2010: **The "Chinese Remainder Theorem" says
that if you have an unknown number of items but know the remainders when you
divide by 2 or more relatively prime numbers, then there is a unique smallest
answer. Our Chinese
Remainders program solves this type of problem. The following sample
was added today:

Cristine has a number of flowers that she wants to put into arrangements.

If she puts them in groups of 2 she has 1 left over.

If she puts them in groups of 3 she has 2 left over.

If she puts them in groups of 4 she has 3 left over.

If she puts them in groups of 5 she has 4 left over.

If she puts them in groups of 6 she has 5 left over.

If she puts them in groups of 7 she has 0 left over.

What is the smallest number of flowers that Christina could have?

**November 11, 2010: **Lots of time spent deer hunting
this week, but no luck so far. The deer became nocturnal much earlier in
the season than usual this year so only the young, dumb, ones are stirring
during the day. It's a long season though so, like programming, I believe
that persistence will pay off in the end.

I did find time to correct a problem with our Cutting Stock
program. Cutting Stock addresses the problem of how to efficiently cut
required one dimensional parts (length or width) from available supply stock.
In 2007, I added the ability to handle required part and stock lengths which
were not integers. It worked when cases were initially entered , but not
when read from a saved case.
Cutting Stock Version 4 posted today, should fix that.

**November 18, 2010:** I bagged my first deer of the season
this week, so I'm taking a break until my grandson visits to hunt over
Thanksgiving next week. Time left over to solve this problem
**"Find 3 different two digit primes with the property
that the mean (arithmetic average) of any two and of all three are also prime"**.
Find 3 Primes in our
Delphi Techniques section finds the only such set in a few milliseconds.
Simple routines illustrate how to generate prime numbers and how to check for
prime means among the 7980 three-member subsets.

**December 3, 2010:** Mathslib, a math utilities unit
in our **DFFLibV13** zip library of
common routines and classes was updated tonight and **DFFLibV13** was
reloaded to reflect a minor bug fix. Function **GetEulerPhi** in **MathsLib**
was changed to return correct value of **1** rather than **0** for **N=1**
or **N=2**.

**December 5, 2010**: Another bug detected by my 6 year-old
"beta tester" was posted today . Cows and Bulls is a number based
predecessor to the Mastermind game. Cows
and Bulls Version 3 corrects DPI scaling problems for high resolution screen
displays, and also now gives an error message rather than looping forever when a
blank guess is entered!

**December 8, 2010:** Arctic cold here in a Virginia
this week has meant more time programming about forestry rather than practicing
it. I ran across the description of a **Biltmore Stick** on Wikipedia and
decided to understand the mathematics behind it "just for fun".
The stick is a tool for rapidly estimating tree diameters when timber is being
"cruised" to estimate its value.
Biltmore
Mathematics in our Math Section investigates how and why the distances
marking tree diameters on the stick are determined. It's a high school
trigonometry level problem which I luckily was still able to handle.

To test the math, the program will also display an English or
Metric customized table of marking distances based on your arm length and the
maximum diameter to be measured.

**December 16, 2010: ** No new programs this week; I'm
working on a small commercial project for a while, then taking a break for the
holiday season.

**January 6, 2011: **A viewer recently discovered that
the default filenames used to store reaction time results in our "ReactionTimes"
program could not be changed, even though the program should allow it.
I'm sure that they worked at one time so the Version 3.0 probably broke it.
**ReactionTimes Version 3.1**
posted today should have it fixed.

**January 1, 2011: **
Happy
New Year!

We're back from a week's cruise in the Western Caribbean with family; round trip from New Orleans visiting Costa Maya, RoaTan, Belize, and Cozumel. We did the typical tourist stuff I suppose: visiting Mayan ruins, zip lining, beach and hot tub time with the grandkids, taking a Mexican Cooking class, and souvenir shopping. All the more enjoyable because Grandma and I were with kids and grandkids, Can't wait to start planning the next one!

**January 6, 2011: **A viewer recently discovered that
the default filenames used to store reaction time results in our "ReactionTimes"
program could not be changed, even though the program should allow it.
I'm sure that they worked at one time so the Version 3.0 probably broke it.
**ReactionTimes Version 3.1**
posted today should have it fixed.

- Age is an issue of mind over matter. If you don't mind, it doesn't matter. ~Mark Twain
- Growing old is mandatory; growing up is optional. ~Chili Davis
- Men do not quit playing because they grow old; they grow old because they quit playing. ~Oliver Wendell Holmes
- The true way to keep age vigorous is to prolong the youth of the mind. ~Mortimer Collins

To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm

337,400
home
page visitors since Sept 2000**.** 275,876 program downloads in the past 12
months!