Support DFF
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.
If you shop at Amazon anyway,
consider using this link.
We receive a few cents from each
purchase. Thanks
The index page for all
Programs on the site?
The DFF Play CD?
Zipped file
DFF Play
CD.zip contains executable version of about 75 of
the 200+ programs from the site, mostly those I particularly liked
or thought would be of widest interest for nonprogrammers.
The file is rather large, about 20mb..
Anything else?
Not a programmer (yet)?
That's OK  the executable
version for any puzzle or game you find here is available for
download. Just scroll down to the bottom of most any
description page and you'll find a "Download executable"
link. Downloaded programs are in "zipped" format to reduce size and
may require an "unzipper" program unless you are running Win XP or
later.
Here's a
link to a free one.
Check out the
Most Popular Downloads from
DFF (updated weekly)
First time visitor?
Take a look at the
Introduction
page to see what this site is about
Notes for Teachers

 
Saturday August
13 , 2005
Delphi For Fun Newsletter #40
Summer is flying by and things have been
busy here. Our big event of the summer was a grand trip to
Switzerland. I worked in Germany for a few years in the 1970's while
our children were young and we fell in love with Switzerland. About 10 years ago, while looking a Swiss
mountain pictures I kind of promised my oldest granddaughter that Grandpa would
take her there one day. She turned 16 this summer, so it was
time. I became tour guide for our family group of 16 (wife, kids,
spouses, and 8 grandkids). Great weather, great scenery, and no
serious problems, all combined to make it a trip we'll never
forget. And, to her parents
consternation, Kristen discovered that 16 year olds can legally purchase
beer in
Switzerland!.
The garden
is in full tilt here. More tomatoes and cukes than I can eat.
Rabbits ate every bean plant while we were on vacation, but were are
sharing the corn about 5050 with the raccoons. Time to start thinking about getting in the
winter's wood supply as soon as the weather cools off a
little.
I have previously mentioned the programming problems in Project Euler at
MathsChallenge.net. Most of the problems are above beginner level but
Delphians are doing well. We
are only 32 of the 1300 active participants, but 11 have made it into the
top 50. I spent the last week
catching up and have now solved 101 of the 102
problems. If you are looking for
some programming
challenges, regardless of your favorite language, check it
out. In spite
of the trip, there has been enough hot and rainy weather weather here to
provide a good excuse for
staying indoors and working on programs. Below are the
additions for the past 4 months.
Enjoy!
April 11, 2005: I sent DFF Newsletter #39 last Friday so if
you think you are subscribed and did not received one, you are one of the 71
subscribers with an inactive account, full mailbox, unknown user, or whose ISP
thinks that DFF sends spam. While watching Tiger
win the Master's Golf Tournament yesterday, I wrote a program to help me
update the subscribers list. Text File Update is a
program that processes a file of
bad email addresses against a total subscriber list and deletes the matches (it could be any
list of text
items). I
included a few extra goodies like options to add unmatched transactions, delete
duplicate master records , ignore or consider
capitalization when matching, ignore leading trailing blanks, etc.
For programmers there's version 1 of a TSyncMemo class that allows
three lists (Master recs., Update recs., Action taken) to be scrolled
synchronously from a single scroll bar.
April 12, 2005: Completed Project
Euler! Yesterday I finished the last of the 95 programs in
this challenging set of programming projects. 5 of the 18 who have
completed all the problems are Delphi programmers. One of them, a
nonnative English speaker, who also recently made it, expressed the
satisfaction best. He wrote "I am happy like a child!".
After working five months on the last problem (#60), I can only echo that
sentiment and say "Me too!"
April 13, 2005: I corrected a small
problem in UBigIntsV2, our large integer arithmetic unit the other
day. (Multiplication by a negative 64 bit integers ignored the
sign). Rather than update all six DFF programs which use this unit, it was
relocated to the DFF
Library file. So these programs will now need
access to the library in order to recompile successfully: Big Integer test, Multiple Length Long Division, Pell's Equation and Continued Fractions. Big Floating
Point Arithmetic, Big Combos
, TShirt
XXL (Armstrong numbers). The error did
not affect any of these programs, so no need to redownload executables, but if
you have the source code, it would be a good idea to download the Library file to get the latest
code.
April 14, 2005: Here is the next version of Cutlist, Version
2.1.3. Cutlist is a woodworker helper program which displays the
optimal layout for a set of parts from a given set of material. This
version adds the ability to specify a "duplicate count" to simplify
entering multiple parts with the same dimension in a project.
There's one more pending request  ability to zoom the displayed results across
multiple pages for better readability for large projects.
Those woodworker guys are really using this! I'll try to get to it next
week.
April 15, 2005:
Inverted
Text, Mirror text, Or
Both?
A fellow wrote the other day asking about "mirrored" text for a
teleprompter application he was working on. I started out to modify
an Inverted Text demo program over in Delphi Techniques, but ended
up with an entirely new application. The TestMirroredText
program described here uses the Copyrect procedure to copy text
from one canvas to another. It turns out that it's smart enough to handle
cases where the left and right (or top & bottom, or both sets of)
coordinates are reversed. the result is a fairly fast way to flip or
mirror, or rotate an image. Along the way, I learned a few more things
about rejustifying TMemo lines and setting
margins.
April 19, 2005:
Two friends
who have an eightquart jug of water wish to share it evenly. They also have two
empty jars, one holding five quarts, the other three. How can they each measure
exactly 4 quarts of water?
Here's our version of the classic "Water Jug Problem"
which will let you try your hand at solving this problem, and many
others. If you have trouble finding the 7 required moves, a button click
will show you how!
April 22, 2005: Version 2 of the Mirrored
Text Test program was posted today. It adds another piece of the
solution for a real teleprompter application: synchronized speedcontrolled
autoscrolling of the input and mirrored text.
.
April 24, 2005: A big "thank you" to all those who
use the Amazon
link at the bottom left of our home page to place your
orders. Today I received a $16.16 Amazon Gift Certificate for your
purchases so far this year. That covers my expenses for a
month! On average I seem to get about 2.5% of what you
spend, so cumulatively, you have spent a hunk of change! Thanks
again.
April 29, 2005: I created a Simple Backtracking Demo on
the Beginners page this morning in response to an inquiry from a student.
There are already several examples on the website, but I enjoy doing one from
scratch because the probability of success is high  it's kind of a test to see
if Alzheimer's has kicked yet. So far, so
good.
May 4, 2005: Here is my version of Buffon's
Needles, is a classic problem which describes a way to estimate Pi by
dropping needles on a grid of parallel lines and counting what fraction cross a
line.
May 6, 2005:

Medium difficulty
level: I found 10 , program found 40
more! 
Akerue is a word search
game originally posted several years ago. Find as many words as you can
from the letter grid and the program will show you those that you missed.
Finding more than half is a challenging task. Here's the first update
which includes improved word selection and better level of play (limiting the
program to smaller dictionaries for easier levels). Why Akerue? Try
reading it backwards.
May 10, 2005:
I ran across this problem in my early Father's Day gift this
year: "The maximum number of individual regions formed by
three lines dividing a circle is seven. The circle contains an ant colony
and each region uniquely contains between one and seven ants. Can
you place seven groups of ants in the seven regions so that for each of the
lines, the total number of ants on either side are all the same? How many
solutions can you find?". This is from Ivan Moscovich's latest
puzzle book Leonardo's Mirror & Other
Puzzles  geometrical puzzles
with lots of color and good graphics. I was going
to write a program to solve the "ant" puzzle, when I realized that our
Brute Force program could
handle it. So "Antics.prb" problem is now included with the
downloads. I also added the ability to include images with puzzle
descriptions to help clarify the equations used.
May 22, 2005: Here's a
program to Convert Decimals to Fractions requested by a viewer a couple of weeks ago. At the time I gave
him a few hints but I assume that the homework assignment is past due by now so
I can safely post my solution to the problem.
May 25, 2005: A couple
of minor bugs fixed today  The UBigIntsV2 Big Integers unit in DFFLibV02 library file had an error in
the modulo routine for 64 bit integers. I also made the second
operand independent of the first operand in Add operations so that
X.Add(X) now works.
In our Reaction Times application, the
Density Plot program required that Delphi 5 be installed in order for the
executable to run. That is no longer the
case.
May 28, 2005:
It didn't take long to for the new Convert Decimals to Fractions program to earn its first update. Regular reviewer/contributor Don
Rowlett pointed out that I had once again ignored the fact that Europeans use
comma (,) instead of dot (.) as a decimal separator. I told him
that's the real reason the USA wants to take over the world. Not for
freedom, democracy, or even oil. We really just want everyone else to use
our decimal point and date formats! But I did fix the program for now to
use Windows "decimal separator" character so it should work where
ever. Don also knew of a trick for converting repeating decimals to
fractional representation, so the user can now specify whether the input decimal
terminates or represents one cycle of a repeating
decimal.
May 29. 2005: Another
viewer, from Sweden this time, pointed out that there was a date format problem
in our Astronomy Demo program. Sure
enough, in computing Lunar eclipse dates, I tried to get the January 1st date
for the current year to internal date format by converting
'1/1/2005'. That works fine if your system expects dd/mm/yyyy or even
mm/dd/yyyy date formats. Sweden's date format is yyyymmdd which
made the StringToDate function complain that 2005 wasn't a valid day of
month. It's fixed now so Sweden can start having Lunar eclipses
again!
June 6, 2005: Some one
posed the Four Dice Puzzle to me the other
day. The problem is to find a set of 4 special sixsided dice which may
have more than 6 dots on a side and may repeat the number of dots on a
side. The set, if labeled A B C D, has the
property that when rolled in pairs, on average, A beats B, B beats C, C
beats D and D beats A! Makes a good nonfair game if you let your
opponent choose his die first. You can always select one to beat
him. This version lets you set a number of
parameters to look for other solution sets and to print the solutions as a deck
of playing cards.
June 8, 2005: Here are
two more simple little programs that I added to the Beginners Techniques page in Delphi Techniques. They do not do much but may illustrate
some new techniques for the beginner's repertoire. DrawDice
draws a random pair of dice with each button click. CountWords lets
you load a text file and get a count and list of the words it contains or
a summary of number of occurrences by word.
June 9, 2004: One more
Beginner's program from a
recent Mensa PuzzleaDay calendar. I called it Expressions864: Find all solutions where the sum of two numbers equals 864.
And by the way, the solution, including the "864" sum must contain all of the
digits 1 through 9 exactly once. Only about 35
lines of code to solve this one, including a test to eliminate duplicate
solutions.
I did also coded the problem in our
Brute Force program and
uncovered a small bug there. In a feeble attempt to eliminate duplicate
solutions, I was eliminating any that had a repeated variable value. But,
of course, reusing a single variable value does not mean that the solution is a
duplicate. I have simply removed the uniqueness test for
now.
June 13,
2005: We're packing for a family trip to Germany and Switzerland so
DFF will have a hiatus until July. It sounds like Europe has had a
cold, wet spring, so we may come back knowing more about Germanic art, culture,
and history than originally planned. But, with enough good food and beer,
sunny mountaintops will just be a bonus, not a requirement for an
enjoyable trip!
July 6, 2005: Back home! It was indeed a
trip to remember for a long, long time. 2 days in Austria and and 14
days in the Bernese Oberland of Switzerland with beautiful weather for all but
the last two days. Here's Grandpa (me) with his 8 wonderful grandkids at
First above Grindlewald. Being tour guide for a group of 16 (kids, spouses
and grandkids) was a bit stressful at times, but all worked out
OK. The four families averaged 400 pictures each so sorting and
weeding them out will surely take longer than the
vacation.
There were 30 DFF feedback emails awaiting my
return. Working through those will take a little time. I posted a
small correction for the numeric edit components TIntEdit and TFloatEdit today (decimal separator issue for European users). I also
made a version of the controls that do not need installation before use that can
be downloaded from the same page.
July 8, 2005: A small
fix for the Intersecting Lines demo was posted today. Overlapping line segments of the same line
were not identified as intersecting. Perhaps we should have a new
"overlapping" category, but for now we just identify them as
"intersecting".
July 10, 2005: The Josephus
problem : A counting elimination "game" named
after the story that Jewish historian/mathematician Josephus Flavius devised a
"fair" way to kill off his troops who insisted on suicide rather than surrender
to the Roman enemy. 41 of them formed a circle and every third man was
eliminated. Maybe not so fair since Josephus, who was not too keen on the
idea, selected a position which assured that he would be the last survivor. At
that point he decided that perhaps it was best to surrender after all. In
fact, the name Flavius is an adoptive name from the Roman family that took him
in!
July 12, 2005: Long time viewer Don Rowlett has made a hobby
of finding (and suggesting fixes for) bugs in DFF programs. Here are two
more minor corrections; in Peg
Solitaire, the "number of pegs remaining" criteria
defining a solution was only checked in Autosolve mode and was ignored for
manual play. It now is checked for both modes. And in Safecracker, the board kept getting smaller as
sizes were rounded down from previous size as board sizes were changed.
New size calculation is now from original board size. Thanks
Don. Keep up the good work!
July 14, 2005: I made a couple of
corrections to NumEdit2 posted last week, Numedit2
contains versions of our Integer and Float edit controls (TintEdit
and TFloatEdit) that do not require installation. Prototype
properties "Anchors" and "Text" were not transferred to the new controls when
they were created. Now they are.
I also posted the first update in several years of Tilefit, a program that takes a set of tiles and
produces random rectangular designs of a specified size. It now
handles multiple colors for the same tile size.
August
5, 2005: Here's program
which solves sets of linear equations using a technique called Gaussian Elimination with Partial Pivoting. Even the title sounds scary.
Fortunately, this demo program is usable to those of us who
are more results oriented and don't worry about the messy details.
As usual, complete source code and other references are available for
those who do want to dig
in.


Oops! 
August 3, 2005: I spent the past two
weeks working on our latest program  a Catapult
Simulator. Users define the mechanical
characteristics of the catapult and the program predicts the flight time,
height, and range of the projectile. Now I guess I had better
head down to the shop and finish that model to see if the program's output has
any relationship to reality.
Gary
Darby http://www.delphiforfun.org/
"On the
road of life, there are drivers and there are passengers...... Be a
driver."  Volkswagen TV ad .

To subscribe or
unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm
122,000
home page visitors
since Sept
2000. 321,000
program downloads in the past 12
months!

