August 25, 2010
Delphi For Fun Newsletter #57
This quarter's newsletter is a couple of months overdue, mainly laziness on my part plus the fact that doing it is a lot more fun than writing about it. J
Here is the description and links for the 20 or so programs created or updated since last time.
April 7, 2010: Six of a Kind is a program to analyze a game that requires six rolled dice to all show the same value in order to win. A viewer's inquiry prompted this program to find out if $1,000 for a win was a fair payout if his club charged $1 to play 3 games. Just for fun, we also analyze the odds of winning for a few additional variations.
April 10, 2010:
|X = target hole for final peg|
Peg Solitaire is a peg jumping game with each jumped peg
removed. The typical objective is to leave one final peg in the center of
the board. A viewer recently asked for help solving two puzzles
which require that the final peg be in an off center location,
Peg Solitaire Version 4 allows the
final peg location to be specified and also adds the ability to save and reload
April 14, 2010: A quick little program from our Mensa Page-A-Day Puzzle Calendar. Executive Bathroom added to the Beginners page in Delphi Techniques section finds all 3 digit odd integers without repeated digits which could be the combination to the bathroom. The search loop has about 15 lines of code. I also displayed the neat Mensa Calendar derivation of the solution. It demonstrates the impact of the right approach to solving a problem.
April 21, 2010: My Water Jugs program has been a fun one to work on. The prior versions solved "Closed" water jug puzzles in which the initial water amount remains constant but must be redistributed across the jugs to meet a given configuration. While researching these problems, I realized that there is another "Open" form of the puzzle where, in addition to jug to jug pouring, water may enter or leave the system by filling or emptying jugs. A classic version which appeared in a "Die Hard" movie, requires that 4 gallons of water be obtained given a water fountain and two jars which will hold 3 and 5 gallons. Water Jugs Version 4 posted today adds ability to define and solve this and similar problems.
April 25, 2010:
Another minor change today to fix a problem that has bugged me
for a long time. For program WordStuff2,
when entering a partial word to be analyzed in "Word Completion" or letters to
be analyzed in "Unscramble" it had been necessary to switch from keying to a
mouse click on the Search button to find solutions. Now, pressing the
"Enter" key also triggers the search. Much better!
May 3, 2010: I been busy cutting next winter's firewood for the past week, but it's raining today so I'll post a new Beginners program in our Delphi techniques section: "Twofer" is the slang expression meaning two for the price of one. Our Twofers program solves two problems that I ran across on two consecutive days and each problem has exactly two solutions.
May 11, 2010: My Logic Problem Solver program is probably one of the 3 or 4 most complex programs on DFF (along with CutList, Roller Coaster, and Word Stuff). It is also the least downloaded of the 4, but "different strokes for different folks" as they say. I still enjoyed the challenge of writing it. A minor update, Logic Problem Solver (Version 3.1), was posted today to clarify and correct some spelling errors in the descriptive text, enlarge text size for these old eyes , and convert references to DelphiForFun.org into live hyperlinks.
May 25, 2010: Catalan numbers were discovered by Euler when he went looking for the number of ways that an N-sided convex polygon could be divided into triangles by drawing non-intersecting diagonals. A more recent interpretation notes that this is also the number of simultaneous handshakes between guests at a circular table that can occur without any arm crossing another guest's arm. In 1838 mathematician Eugene Catalan documented the same series (shifted by a couple of positions) as the number of ways that an expression with N +1 variables and connected by binary operators could be parenthesized. Today's Catalan Numbers program in the Math Topics sections presents a program which not only calculates the Catalan number for expressions with a given number of variables, but also enumerates and lists all possible expressions.
May 31, 2010: A recent London Times "mathematical" crossword puzzle posed a problem involving "almost" pandigital numbers (numbers containing digits 1 through 9 exactly once). To help a viewer solve the puzzle, Problem #6 was added to our Pandigitals program, Version 3.1 which was posted today.
June 5, 2010: Last month's posting prompted viewer Erich to play with our Logic Problem Solver and expose a bug which has existed for years. Did you know that given propositions "A implies B", "B implies C", and "A and C cannot both be true", then one can conclude that A is false? My logical brain knew that back in 2002, but my programming finger slipped and I was declaring A to be true. Logic Problem Solver Version 3.2 fixes it.
June 15, 2010:
Saw 1" boards leaving 12" Cant from 24" Log
Have you seen a modern sawmill with a computer controlled saw on TV? The computer analyzes and displays for the operator's
approval, the optimal sawing pattern for converting each log into boards based
on laser measurements taken. Smaller sawmill operators without computers
or lasers to control their mills must perform the same task using their
experience or some other strategy. I'm not privileged to own a sawmill,
but as a woodlot owner with a woodworking hobby, a small band mill
is sure tempting. Here is a program,
Log Sawing Patterns, which I
imagine could be developed into something useful if I ever succumb to the
June 18, 2010: The June 12th Mensa Puzzle-A-Day calendar puzzle asked for the two 2-digit numbers which are 3 times the product of their digits. It took less than 20 lines of code to find the answers to this and for other multiples for all 2 and 3 digit numbers. DigitProducts on the Beginner's page of our Delphi Techniques section has the source and executable to provide the answers.
June 25, 2010:
|7 - a winner!|
Craps is a dice game with scoring based sum of rolling 2 dice.
Craps Odds calculates the
theoretical chances of winning or losing for each of the eleven possible initial roll
outcomes (2 through 12). It also has a page which simulates a million
games to verify that the theoretical probability results are valid.
July 7, 2010: Too hot here to do much outside so I have had an excuse to get back on the computer. It reached 86 degrees here today which is hot by mountain standards, but the flatlanders are suffering 100 degrees so I guess we shouldn't complain.
Validate Numeric Input was one of the first programs posted on DFF and , frankly, I had not looked at it in years. It described a coding technique to validate numbers as the user entered them. A viewer wrote recently requesting the ability to validate multiple integers separated by commas in a single text string in the same manner. Version 2 posted today provides that capability. It also includes sample code to extract and convert multiple numbers from the string as required.
July 17, 2010: I have been working on a "railroad shunt puzzle" solver in my spare time for the past week or two. It's an interesting but challenging problem and I have ways to go. Fortunately a sharp user has given me something to post. Peg Solitaire Version 4.1 implements fixes for three bugs found and corrected by a sharp Delphi programmer from Sweden. (Last name spelled Andersson with "ss" led to the Sweden guess).
July 22, 2010:
I'm not sure of the definition of "Dog days" but the hot, humid. weather recently seems to qualify. The month has flown by as I work on planning a family reunion vacation over Christmas holidays. As grandchildren grow up it becomes more difficult to coordinate availability around school schedules (three different states), summer jobs, band camps, etc. etc. We're apparently not alone which explains why, for example, cruise prices tend to double for the week between Christmas and New Years. But it looks like it's going to happen! Whew!
Here's a simple
Compass Drawing Demo
posted in our Delphi Techniques section today. I adapted it from an
aircraft instrument simulator which I never got around to post and demonstrates
a few useful techniques like smooth animation, drawing text at angles, and the
handy Sin and Cos trig functions.
August 6, 2010:
Drag the lettered blocks onto the template to form valid words reading across
and down crossword style. I only have this one example of this type of
puzzle, but Version 2 at some future date will use our dictionary unit to help
generate more. In the meantime, Fit the
Pieces, Version 1.0 was harder to solve (and to program) that I would have
thought. Maybe I am getting old!
August 9th, 2010: As regulars know, there are no advertisements in DFF. I do get emails occasionally offering $ to place a link for this or that product or service. I decline because I would not want to promote what I do not know and I don't aspire to be in the evaluation business. Today however, I am recommending The Cat Connection as one of the "good guy" businesses because of recent experience. I had purchased a clever device called the Loc8tor Pet from them several months ago ($99, free shipping). It consists of two small tags that fit on the pet's collar and send a radio signal response when they receive a locator request from a hand held radio direction finder device. It works great for tracking the cat down when it's time go come in for the evening, although I'll admit that it is more for our peace of mind than his. One of the tags stopped working last week while under warranty, the hang-up being that the device is manufactured in the UK and that's where the customer support is located. I was dreading sending the tag across the big water for a replacement and before doing so, called Erin at the Cat Connection. To my surprise, she offered to send me a replacement tag and a prepaid label to return the broken one, which she did. When you call, a real human being answers the phone who actually wants to help! That deserves a no charge recommendation. If you have a cat (or dog, or other items you don't want to lose) check out the Cat Connection and the Loc8tor Pet.
August 21, 2010: There's no particular reason for the
delay between programs this month. Just slowing down I guess.
Today's program asks, How Many
Triangles? in this figure and takes a considerable amount of effort to answer
with pencil and paper or with a program.
August 23, 2010: Catching up on the backlog, here's some sample code posted in Delphi Techniques section showing how to Move String Grid Rows using arrow buttons to move a selected row up down by one row, one page, or to top or bottom of the grid.
August 24, 2010: Some encouraging news for those of us waiting for an affordable "learners" version of Delphi. I ran across this report today at this Network World site and at several others:
Company officials discussed plans for Delphi at the Delphi Live conference in San Jose, Calif., on Tuesday, stressing the new technologies would be released in 2011 only if they are ready by then. ...
... Later this year, the company also anticipates introducing starter kits to entice neophyte developers to the company's Delphi and C++ technologies.
I've tried for years to convince them that they need to do more to "spread the word", so this sounds good to me!
Necessity is the mother of taking chances. -- Mark Twain
Even if you're on the right track, you'll get run over if you just sit there. -- Will Rogers
On the road of life, there are passengers and there are drivers. --- Be a driver -- Volkswagen TV advertisement
To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm
321,000 home page visitors since Sept 2000. 263,000 program downloads in the past 12 months!