Wednesday, October 29, 2003
For Fun Newsletter #34
is here so it must be time for our quarterly update for you faithful
DFF subscribers; around 600 now.
Muzzleloader season is only a week away. I have enough
firewood to last the winter and only a few more Christmas
complete down in the shop. So we should be ready to get down to
some serious programming when the snow flies.
It seems like user feedback has led me to lots of “fix-ups” and
enhancements this fall, although there have been a few new works implemented
and removed from the “Future Projects” list.
is the only totally new game/puzzle that comes to mind as having been
published this quarter.
Simulation simulates multiple elevators running at the same time.
The elevator motion is animated and run under manual control.
The next version will run predefined scripts and allow users to control
how requests are met.
List is the most recent addition – it tries to find the best way to cut
a list required material pieces from available stock.
new projects include
in Delphi Techniques and
in Math Topics.
did pass a couple of milestones recently
- September marked three years of operation for the Delphi For Fun
website and we also passed 50,000 home page views.
Total pages viewed now averages about 50,000 per
month mostly from search engine referrals.
will be the first newsletter sent under our host’s new “SmarterMail”
mail/list server. Let’s hope
that it lives up to its name.
Here’s the complete
"What's New" items since last time.
A viewer from New Zealand pointed out that my
program had his sun rising in the evening and setting in the morning. He
reported that he was having trouble sleeping under those conditions so I fixed
it today. A slight southern hemisphere glitch was the cause.
As usual, I found another problem while there - the Analemma graph only
worked after the "Sunrise Sunset" button had been clicked.
Fixed that one too.
Today's Mensa© Puzzle Calendar problem: Jim
was arranging his identically sized stamps on page. When he put 8 to a
page, he had 1 left over; with 9 to a page, he had 4 left over; with 10 to a
page, he had 1 left over; and with 12 to a page, he had 1 left over.
What is the smallest number that will allow him to fill each page with the
same number of stamps?
solved it by exhaustive search in about 10 minutes, then recalled that it
sounded like a Chinese Remainder problem. Sure enough, I had posted a
program a couple of years ago that would have solved it. So I went
back and added this problem to the samples that are included with
Solve it either way - take your choice.
August 16, 2003: Version 6 of the Roller Coaster Simulation program was posted today. It adds a template feature suggested by Dr. Jon Thomsen of the Technical University of Denmark. The idea is to allow his Dynamics engineering students to better compare their theoretical predictions with simulation results. Wow, my program is going to college!
mentioned that to Bernd and a few days later he had enhanced his code to
return the optimal (lowest move count) solution for all boards. This
truly final version of
was finally posted today.
24, 2003: Viewer
and unofficial chief beta tester, Don Rowland, reported some bugs in the
program the other day. He suggested fixes for some, and I fixed the
rest. No bugs left in this program!
is based on a program written by a young Delphi programmer from
Czechoslovakia posted today over in Delphi Techniques.
It is a clever demonstration of 15 different text and graphics
effects. I added some user inputs to replace hard coded values,
generalized the "Contrast" page to handle multiple values, and
added a "Brightness" effect. Most of the rest is as
"Ivanoslav" wrote it.
Two years ago I published
in the Math Topics section of DFF. It discusses the probability that N
randomly selected people will share a common birthday. Like nearly all
of the discussions of this problem, it ignores the existence of
Feb 29 birthdays during a leap year. Someone pointed out some code a few
months ago that addresses the leap year issue. The statistics
change very little but the difficulty of understanding the methodology
increases a bunch when leap years are introduced. I finally spent
a day working through the algorithm and posted my description and revised
program in a separate
Birthdays Leap Year
3, 2003: Viewer Mark wrote today about a problem with another
old math demo program,
>From 3 Points. He was confused because the Y coordinate
increased toward the bottom of the screen. So normal for us
programmers that I forgot that it was not so for everyone else. I fixed
Max Burgos has been converting my
program to Visual Basic. He pointed out two errors in the
Delphi version, one of which is now fixed. In the diagram at left, the
first figure in the "Easy" figure set, the large red triangle could
have been rotated and dropped over the small green triangle without the
overlap being detected. There were all sorts of tests for shared
borders and intersecting sides but the "completely enclosed" case
slipped through. If you want to gain an appreciation for the human
visual system, study the algorithms to determine whether polygons touch or
second error is not so easily fixed. The fourth figure in the
"Veryhard" figure set can be incorrectly solved leaving a empty
space (Place the parallelogram across the "arrow shaft" - it
should not fit, but it does). The problem is that figures get
distorted as they are rotated because the coordinates used to define pieces
and figures are not accurate enough. No luck so far in making
the definitions more accurate and still keeping existing figure definitions
Thanks to sharp-eyed (and sharp) viewers, this seems to be program
fix-up month. To go along with the theme I posted a new version of
today; The original program corrected a particular problem I had
with a malformed file that included an extra carriage return at the end of
each line. Steve Moller from the land down-under recently made a
worthwhile addition to the program by incorporating Delphi's AdjustLineBreaks
function. This function corrects other common line break errors by
inserting missing Cr or Lf
characters to make valid line endings. It also reverses Lf-Cr
sequences to Cr-Lf.
While at it, I added a display form to show hexadecimal and character views
of the input and output files. Just for testing I've added file
PasDoc2.txt with missing
carriage returns in the downloads.
Square appeared in an engraving by Albrecht Dürer in 1514.
This program, posted some time ago, challenges the viewer to see how
many of the 86 number combinations adding to the square's magic number
they can find. Viewer Don Rowland recently noticed a minor
problem while finding solutions - the program allowed selecting the same
number more than once! Together we came with the fix posted
Rowlett reported a minor problem with a
posted some time ago. The program is mainly a demonstration of depth
first search techniques as it checks all paths through a grid of numbers
looking for the path with largest and smallest sums. The grids are
randomly generated and the display for the largest size had been truncated.
posted today one more attempt at improving the piece moving method in
Max Burgos found another bug allowing pieces to be dropped on top of
other pieces under some conditions. I replaced the
PointInPoly procedure with one that works only for convex polygons (polygons
without indentations). If we move around such a polygon (i.e.
tangram piece) and check each side against a point being tested, any interior
point will always be on the same side of each edge. Any exterior
point will always fall on both sides of the lines through the edges
September 21, 2003: Today's program over in the Delphi Techniques section explores threaded processing. Threads are separate processes that run independently within a single program's space. I have been working for several days on an Elevator Simulation program. Controlling these things is a tougher problem than appears at first glance, partially because the order of handling requests depends on the state of the system as well as the order received. To make a long story short, after several false starts, I decided to define the elevators as thread objects where they can operate independently. Threads test 1 - Elevators looks like a promising start. And I learned enough about threads coding in the process to make a separate posting seem worthwhile.
need a break to pay play with my new log splitter! .
A viewer wrote the other day asking if I could validate American Express card
numbers. I don't have a Amex card, so can't be sure,
but I posted a version of the Check
Digits program today that tries. It validates my Discover card
OK, as well as Visa, MasterCard, "mod 11" ISBN (book) numbers
and traditional "mod 10" check digits. Perhaps an
Amex card holder will send me feedback if the program happens to work for
It has been
a while since I posted a program partly because we're trying to get ready for
winter here on the mountain. Also today's posting,
was one of those simple little ideas that turned out to be not so simple to
implement. It started while thinking about the "people
generator" for version 2 of my elevator simulation program.
Simulating the time between random arrivals often assumes an Exponential
distribution, which is related to another distribution, the Poisson,
describing arrivals per unit of time. I decided to post a
Math Topics program describing this relationship and showing how the
statistics of sample data relate to theoretical statistics. What
the heck, might as well throw in the Normal
distributions and maybe an illustration of the remarkable Central
Limit Theorem. Two weeks later, here it is.
18, 2003: Thanks
to viewer Brandon Hunt, the confusion over Amex and Discover cards has been
cleared up. They do use prefix digits in creating check digits.
All major cards use the same algorithm as described in the ANSI standard that
governs credit cards: ANSI X4.13, "American National Standard for
Financial Services - Financial Transaction Cards". Hans Peter
Luhn, one of the early pioneers developing techniques for making computers
useful, developed the algorithm. He was granted the check digit patent
in 1960, at age 64. Who says that us old codgers lose our mental
faculties? I reposted the
Digits program today with the new information and deleting all that
foolishness testing whether card number prefixes are required - they are. .
Viewer Joe wrote a few weeks ago asking if I could make a version of our Four
In A Row game that would allow three humans to play each other. He also
wanted to be able to set a larger board size.
In A Row, Version 2B
does it. Have fun Joe!
October 27, 2003:
Cut List is a list, or better yet a diagram, showing how to cut material
pieces required for a project from a set of available stock pieces.
an update of a program I wrote 10 years ago to solve a particular problem
something incredible is waiting to be known."
Carl Edward Sagan
To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm
page visitors since Sept 2000. 179,000
the past 12 months!