April 3, 2008
Delphi For Fun Newsletter #49
It has been a short winter this year; temperatures are mostly staying above freezing now, the maples are starting to show red, and the deer are happily nibbling on my wife's flowers as they pop their heads through the ground (except for the Daffodils which must taste bad). Only two weeks before our big trip to Europe (mentioned in Newsletter #48)! Postings on DFF for the next couple of months will be scarce but please continue to send feedback when you find bugs or have suggestions for projects. I'll have a new Dell XPS laptop with me and will try to acknowledge emails whenever we get to an Internet access point. Probably not much programming until late June though unless I tire of enjoying flowers, mountains, castles, museums, and all that good food & drink!
Here's a summary of what I've been up to so far this year:
January 16, 2008: Version 3 of our Age Problem Solver can now handle the latest twist from our 2008 Mensa Brain Puzzlers Page-A-Day Puzzle Calendar about Nick and his unnamed grandfather. Since we need names as the variables for age in the equations we build, "grandfather" is now recognized and named "Grandfather". The logic applies to some other relatives as well, so we can now solve problems involving "father", "mother" and "grandma" as well.
January 23. 2008: I've stayed busy this week playing with Turbo Delphi Explorer, a free version of Delphi 2006 (Delphi 10 if the numbering system hadn't been revised). See the Turbo Delphi site for more information. I'm looking at what problems and advantages would follow from making it the standard compiler for DFF to finally replace Delphi Version 5. More on that topic in the coming weeks.
In the meantime, a user question about right aligning text in our TPrintPreview class led me to today's update for programmers which adds some margin control. PrintPreviewDemo illustrates the changes. There's lots more that could be done here, but today's posting is a definite improvement over last year's version.
January 24, 2008: I updated the Delphi Version Testing page today to include the conditional defines for recent version numbers. This is to allow some compatibility when compiling the program used for testing a new replacement class for TSpinEdit. I have used TSpinedit in many programs on DFF but it is not included in Turbo Delphi Explorer :>(. But I'll be posting a replacement soon :>).
January 26, 2008: The Turbo Delphi investigation study continues with the posting today of a Spinedit Replacement Demo program which defines (and tests) a TDFFSpinEdit class which replaces TSpinEdit. (TSpinEdit is not available in Turbo Delphi.)
January 28, 2008: We're still playing catch up from the holidays. Here's an update for our Roll Call Solitaire simulation program. Roll Call is a simple solitaire card game where you pass through the deck counting from 1 to 13 repeatedly as you turn each card and removing cards that match your count. Passing through the deck without removing a card counts as a "strike" You lose with 2 or 3 consecutive strikes, Today's update answers some (but not all) questions about zero-strike games and the distribution of strike counts for winning games.
February 1, 2008: Version 2 of "Cows and Bulls", a pattern guessing game, was posted today. Cows and Bulls is an older version of "Mastermind", the board version of the game using colored pegs instead of digits. Because there are 10 choices rather than 6 for each pattern position, finding the pattern is much harder. Among other new features, this version provides some help by allowing you to see the remaining possible solutions as guesses are made.
February 6, 2008: One of the first programs posted on DFF, back in 2001, was Reaction Times, written to help one of my grandkids with a school project to measure the response time to click a mouse button when a colored pattern was randomly flashed on the screen. The data is captured to files and a couple of other programs help analyze the data. Since it was published, I hear from a student about once a year with questions or a request for some enhancement. This year's experimenter wanted to know how to get the frequency chart of response times copied so that she could include it in her report. Due to a big oversight on my part, it turned out that there was no easy way! It seems like I should have recognized that virtually all school project reports are prepared on computers these days. Anyway, a new version of the Density Plot program was posted today which corrects the situation. In addition into adding several charting options, there are now buttons to print the chart, save it as a bitmap (BMP) file, or save it as a Windows Metafile (WMF) file. WMF files are much smaller than BMP files and may scale better when inserted into Word documents.
Yesterday's Mensa Page-A-Day Puzzle calendar has another age puzzle: "Allan is twice as old as Gloria was three years ago. In three years, Gloria will be as old as Allan is now. How old are Allan and Gloria now?" Our Age Problem Solver solves this using the text as input. And without any updates to the parser tables! I added the puzzle to the download zip files bringing the number of solvable sample puzzles to 12.
February 10, 2008: A number, the sum of whose proper divisors is equal to the number itself, is called a perfect number. If the sum is less than the number, the number is deficient and if the sum is greater, it is abundant. (Proper divisors are divisors which a smaller than the number itself.) It has been proven that every number greater than 83,160 can be expressed as the sum of two abundant numbers. Here's a little Abundant Numbers program that answers a few more questions about which kinds of sums can (and can't) be formed.
February 20, 2008: We spent President's Day with my daughter and her family in Connecticut. We had a good visit and 11-year old grandson, Luke, gave me a couple of good ideas for future projects.
As a homework assignment, he had made a word search puzzle (with words from The Odyssey!) in which he cleverly used partial versions of the words as space fillers and filled in the remaining unused letter spaces only with letters that appear in the target words. From experience I can tell you that both of these "features" make it significantly harder to find the words. I plan to incorporate his ideas in my Crossword Puzzle builder which also makes word-search puzzles.
He also had an original "Rush Hour" puzzle configuration which was particularly tough to solve. Rush Hour is a puzzle game by Binary Arts which challenges players is free a particular vehicle by sliding other plastic vehicles on a constrained board so as to open a path to the exit. My version of the game is called "Traffic Jam" and I plan to add Luke's puzzle to it.
In the meantime, here is a "Sentence Parser" program written to help a fellow teaching English as a foreign language in Indonesia. He wants to write an automatic translator to help in some online training software he is developing. This provides him with a start by identifying words, sentences, and paragraphs as well as recognizing abbreviations (so that their "dots" do not count as end-of-sentence delimiters)..
February 25, 2008: It has been three years since we visited the world of Keno. A recent email from a fellow in Brazil prompted Keno Version 2 posted today. The Brazilian national lottery is a version of Keno which they call "Lotomania". In this game the "Pool" is 100 numbers, 20 "Spots" are selected and the "Draw" is 50 numbers. I expanded Keno Version 1 to allow user selection of Pool, Draw, and Spots values. I also expanded the Payout results table to include theoretical and observed odds as well as probability for the number of "catches". The program verifies that the government published odds of 20 catches is 1 in 11,372,635 games. (Well, actually I calculate it as 1 in 11,372,376 but, close enough.)
March 3, 2008:
You are given four piles of blocks, each 6 blocks high and containing the letters "A" through "F". These are scrambled versions of the unknown "Solution" stack. For each of the 4 stacks, you are also given the number of pairs that have a match in the solution stack and the number of pairs that are reversed versions of pairs in the solution stack. Your job is to reconstruct the solution stack. If you are really quick, you can do it the way Pile Up Puzzle does it - just check each the 720 possible arrangements of 6 letters to find one that has the specified number of matching and reversed pairs when matched against each of the given stacks. (The computer averages about 0.002 seconds to do this.)
One of the bittersweet aspects
of growing older is the realization that, sooner or later, your
grandchildren will be smarter than you. During recent visit,
grandson Luke came into the living room one evening with copies of a
WordSearch puzzle he had created as a homework assignment. The words
to be found were from a list provided by his teacher from their current
reading project, a little tome entitled "The Odyssey"! He is 11
years old and in the 6th grade by the way. I'll admit that reading
"The Odyssey" is still on my To-Do list, and nowhere near the top.
The entire family had to find the words in Luke's puzzle and I came in dead
last. But at least I did pick up a couple of his techniques that I
added to Version 3.1 of our Crossword
Generator program (which also builds WordSearch puzzles).
Luke included fake partial words to lead you down the wrong path and he also
preferred inverted, backwards, and inverted-backwards orientations
over those easier to find. I've tried to incorporate both of
these features in this version. The
puzzle at right is from my program - not as good a Luke's but still contains
his word list (TELEMACHUS, LACEDAEMON. PHAEACIANS, ODYSSEUS, MENELAUS,
POSEIDON, ATHENA, ITHACA, NAIADS, SUITORS).
March 13, 2008: A modified version of our "Monitor Power Off" program was posted today to optionally issue either a Standby or Poweroff command when the pause key is pressed. ("Standby" doesn't work on some systems.)
A little "March Madness" has struck here:
March 15, 2008: A month or so ago we visited my
daughter and her family in Connecticut. I've already implemented
grandson Luke's improvements for the WordSearch puzzle generator. Today
I posted another enhancement suggestion of his for our Traffic Jam program, a
Delphi implementation of
Binary Arts' Rush Hour Puzzle. In Luke's
version shown a left, the Yellow car blocks the Red car (which must reach
the exit to win), and travels in the same row as the Red car. Luke says
that some of the advanced sets of "Rush Hour" puzzle card packs use this
complication, but we couldn't find any in his collection. In any event,
Traffic Jam Version 1.1 posted today
allows user play and computer solution of this case and others like it.
March 22: 2008: Our Maze program was originally written in 2001 and has not had an update in several years. It allows users to generate and solve or print mazes of arbitrary shape and complexity. Today's update was to help a programmer who wants to make some changes to the program. Maze Version 2 makes it easier to recompile the program on a standard Delphi system and fixes a few other small bugs. The original write-up was made before I realized that many non-programmers might also be interested in these programs, so the descriptive text concentrates on the code. But if you download the executable and play with it, I'm sure you can figure it out.
April 1, 2008: A pandigital number by definition contains all of the digits 0 to 9 exactly once. An "almost: pandigital number is 9 digits long containing 1 to 9 exactly once. Previous versions of today's program solved a couple of sample problems about these number types mainly as a programming exercise. Today's update, Pandigitals Version 3.0 answers three additional problems about pandigital numbers proposed by viewers:
April 2, 2008: Being retired, I don't spend much time in my car listening to radio these days, but I do enjoy NPR's CarTalk program while in the shop on weekends. One of the best parts is the weekly "Puzzler". This week's was solved with a simple program that I decided to post as a Beginners level program in our Delphi Techniques section. Here's a link to the puzzler details and download page for Car Talk Reversed Ages puzzler program.
folks are about as happy as they make their minds up to be." -- Abraham Lincoln
To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm
233,500 home page visitors since Sept 2000. 401,000 program downloads in the past 12 months!
Copyright © 2000-2017, Gary Darby All rights reserved.