January 11, 2010
Delphi For Fun Newsletter #55
Another season, another newsletter.
This newsletter is being sent with a version 9 of MailListKing, the mailing list program written in Delphi, which has had a few problems in the past when sending many emails. It has features that make it easy to add new members, process "unsubscribes" and invalid email addresses, etc so here's hoping the sending problem is fixed.
Most of our hemisphere is feeling the cold more than usual this winter, The last month has take taken two months' worth of firewood here in the Virginia mountains. A good excuse to stay in and write programs though, except for my daily outing to scatter a little corn to help our deer and turkeys survive. It's nature's way that the most fit survive even if humans occasionally try to nudge the process one way or the other. Too bad that so many "environmental" groups and the "no climate change" advocates don't recognize that change is inevitable and, in the long run, a good thing. Without change, we would not be here!
Oops, sorry for the minor rant - solving problems and puzzles with the computer is much easier and less controversial than getting agreement on whether man is part of nature or can control it. Here are my "What's New" entries for the last quarter of 2009.
October 4, 2009: Number Words Version 2, posted in the Delphi Techniques section of DFF, builds on the original version by adding conversion back from "number words" to numbers (e.g. seventeen to 17). It also solves, or allows you to solve and check, the answer to one of those self referencing statement puzzles: "This sentence holds _________ L's, __________ N's, and __________ vowels in all." where the blank fields are to be filled with number words which make the statement true. This is another recent puzzle from my favorite source, the Puzzle-A-Day Mensa Calendar.
Note: I have a Lazarus/FPC version of this program but I don't feel comfortable in distributing it yet. Lazarus is a free open source front end to Free Pascal Compiler (FPC) and which provides a Delphi look-alike environment. As you may or may not know, Embarcadero, the current owners of Delphi have withdrawn all free versions and do not seem interested attracting or retaining the student/hobbyist programming community. What a shortsighted approach!
I admire the work that has been done on Lazarus, but I've had a hard time getting things to run. Whether that is due to differences with Delphi, bugs, lack of documentation, or just my ignorance has yet to be determined. If there are Lazarus users out there who would like to help educate me, let me know and I'll send the program and a whole bunch of questions.
October 16, 2009: BigFloatTest was reposted today to incorporate two small changes to our large floating point arithmetic unit UBigFloatV3. The Add procedure to add one TBigFloat number to another could produce erroneous results when a number with a very large exponent was added to another with a very large negative exponent (a very small number). Also procedure Reciprocal could loop and produce an "Out of Memory" error under certain conditions. Division uses Reciprocal to divide by multiplying and a user encountered the error when computing 1/99,999,999,999,999,999,999. Thanks to Charles Doumar for the corrections posted yesterday in library file DFFLibV13.
October 17, 2009: An ongoing task these days is converting and recompiling programs that have display problems when operating system DPI scaling is set to increase text size. I'm converting them as I encounter problems. Today's posting is BigCombos which displays combinations and permutations of arbitrarily large size. I needed the program to convince a viewer that it is not feasible to check all possible ways to arrange 68 items. There are are about 2.5 x 1096 ways; much larger than the estimated number of atoms in the known universe (1080).
October 18, 2009: Woohoo! I found out yesterday that I have been nominated for the "Spirit of Delphi" award. I recognize enough names on the list to make me proud to be included in that company even though participating in "community" has never been a priority.
I have heard a rumor that Embarcadero, the current owner of Delphi, is considering a free or cheap "learners" version of Delphi. IMO, that's our best hope to have the language survive into the next generation.
2009: The Jumping Frogs puzzle is easy to find on the
web. My simple version has "Undo" for user moves but was written mainly to
make sure I remembered how to search a "state graph" for solutions.
October 29, 2009: In the original October 25th version, the Jumping Frogs were too large for the pond on most systems (those which do not use DPI scaling). Hopefully, it's fixed today.
November 2, 2009: This card probability question was posted, and partially answered, three years ago.
Given two card rank values, what is the probability that there are one or more occurrences of the two values being adjacent or with only one intervening card in a well shuffled standard 52 card deck?
The original version used generated random card decks to answer the question experimentally by checking lots of decks and counting what proportion of them met the card placement conditions. I had asked then about an analytical solution - it took three years but programmer and fellow puzzleist Mark Rickert came with the key concept (and sample C code) that allows exact solutions. Card Probability Version 2 has my implementation of the algorithm and even throws in Mark's C code translated to Delphi as a bonus!
November 13, 2009:
Our AARP Bulletin this
month contains this puzzle, shown here partially solved. It's an example of a
puzzle game called KenKen; similar to Sudoku except that the board is divided
into "cages" with an operation and a target value associated with each
cage. The digits 1 to 5 must be placed on the board so that they can be
connected with the given operator to form the given target value in every
cage. In addition, no digit can be repeated in any column or row. My
KenKen Version 1 program is a simple playable
test bed to help investigate algorithms for automatically solving this
type of puzzle "just for fun". At the puzzle owner's request I am
informing you that KenKen® is a registered trademark of Nextoy, LLC and that
this site is not affiliated with Nextoy, LLC or KenKen Puzzle
November 19, 2009: While working on some upcoming changes to our Sound generator program, I discovered that our Metronome program posted several years ago, does not like to play the "click" wav files when run under Vista or Windows 7. Metronome Version 2 adds two additional "click" sound files to address the problem. Click1Vista and Click2Vista files extend the duration of each click to be audible. Vista made major changes to audio processing including moving many functions to run as a service. For some reason, the minimum played sound now seems to be 31 milliseconds.
November 15, 2009: This may be a project first, coding KenKen Version 2, with the "Solve it" button, turned out not to take as long as I though it would! I included one additional sample test puzzle also; a 9x9 hard version that I wouldn't care to solve by hand.
November 24, 2009: We're off to spend Thanksgiving with family and then taking a two week repositioning cruise hitting a few western Mediterranean sites in Italy, France and Spain and the across the big waters to New York City. I'm not sure about Internet availability on board, so if email responses are delayed, be patient; I'll catch up when we get back in mid-December.
December 18, 2009: Safely back home from our first (and last) repositioning cruise. The first week, visiting Barcelona, Cannes, Florence, Rome, Corsica, and Malaga were great. The second week, crossing the Atlantic, not so much. We're not into casinos, disco, game shows, rock wall climbing, or spa treatments, so that left plenty of time for reading. Of course, being retired, I have plenty of time for reading any week I choose. Seas were rough a couple of days with 30+ foot waves and quartering head winds of 90 to 100 mph. I wish I had had an accelerometer to measure the G forces imparted when a 93,000 ton ship descending collides 180 degrees out of phase with with a 30 foot wave. Not enough to shake one out of bed, but enough to prevent sleep for sure. No sea sickness for us, but I was unlucky enough to pick up an unpleasant intestinal virus two days from port from which I'm just recovering. So, we've chalked it up to "live and learn" and move on.
There was only one programming request that seemed to require action when we returned home. The Traveling Salesman Problem program posted in 2002 allows users to trace paths visiting all of a random set of cities and compare their distance to the shortest distance calculated by the program. There are options for "closed" or "open" routes depending on whether we end up at the city we started from. A student using the program for a project has a requirement to begin the open route at a specified city but my original version always started at the western-most city. Traveling Salesman Problem, Version 2 posted today corrects that oversight and starts open routes at the first city selected by the user.
December 28, 2009: Here's wishing everyone a happy holiday season. Christmas here was not the best ever here along the Blue Ridge. Ice and wind on Christmas eve knocked out our electricity for 3 days. It was a small reminder of what it was like in the olden days without power. Believe me, with power is better, (especially for a computer programmer ). It's back today, so I'll get one more program posted before the year ends.
Circle From 3 Points, Version 2 is a extension of our program which explores the math defining the circle passing through any 3 given points (unless they happen to fall on the same straight line). The original version used mouse clicks to define the points. Version 2 allows users to input three floating point values of arbitrary scale. I needed that to help solve a specific puzzle from one of the puzzle books received as a Christmas gift.
January 2, 2010:
Happy New Year! We'll kick off the new year with a program that I wrote a year or so ago but never got around to posting. Accordion Solitaire is a simple solitaire card game that is difficult to win; perhaps one win in 100 games. This version allows user and program play and implements a "sweeper" strategy of play which can increase the odds of winning to perhaps 10%January 4, 2010:
While playing the "Wii Play" version
of the Four-In-A-Row game with a grandson over the holidays, I used my Delphi
version of the game to advise me on moves to make. I was embarrassed
to find that the program's random moves "enhancement" frequently allowed Chris
to win by placing 4 adjacent token in his first 4 moves - the initial random
moves feature assumed that there would be no winner that soon.
A Row Version 2.2 posted today fixes the problem by
limiting initial random moves to 2 or 3 turns.
"Instant Insanity" is a variation of an older cube arrangement puzzle and one of a large family of similar puzzles. In this one, we have four cubes with one of four colors on each face of each cube. The objective is to stack the cubes so each column of faces has all four colors.
A viewer recently asked for help in
developing a Delphi solver version. Most of the online literature
describes a graph search algorithm which can be applied to find solutions with
pencil and paper. With a faster but dumber computer, it's easiest just to
check all 41,472 possible arrangements looking for solutions.
Instant Insanity Version 1.0 posted today does
just that with a few sample or user defined cube sets.
quality of a person's life is in direct proportion to their commitment to
excellence, regardless of their chosen field of endeavor. - Vince
Lombardi (Football Coach)
Talent is cheaper than table salt. What separates the talented individual from the successful one is a lot of hard work. - Stephen King (Author)
To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm
298,000 home page visitors since Sept 2000. 217,000 program downloads in the past 12 months!
Copyright © 2000-2017, Gary Darby All rights reserved.