October 26, 2009
Delphi For Fun Newsletter #54
Another season, another newsletter.
Our new cat, KP (Kamikaze Possum) is living up to his first name at least. He's gained about 5 lbs since we acquired him in July and still loves sneak attacks on feet, legs and ankles. The Cat Castle is completed and a favorite napping place.
Quite a change from
July to October!
On the business side, I spent some time in the past month or two investigating Lazarus/Free Pascal as a Delphi replacement. Unfortunately, it does not seem ready for prime time conversion of existing Delphi programs. I think that it might work much better for new projects but I have not spent much time trying that aspect. I'll try it on a few simple projects in the coming months.
Embarcadero, the current owner of Delphi is aware that today's students are tomorrow's customers and will hopefully release a free/cheap learning edition of Delphi sometime. When or what it look like I do not know. For the future of the product, we can only hope that it happens sooner rather than later. As of today, I don't know of any way for a beginner to learn Delphi unless they work for a company that provides it.
the meantime, if you're a program user or a programmer lucky enough to have access to
Delphi, here's a summary of the programs posted since our July newsletter.
July 17, 2009: It's been a month since the last program posting for a number of reasons, mostly related to having other things that were more fun to do. I have spent spare hours for the last week or two working on Dice Probabilities Version 3. This update was prompted by a viewer who is hooked on a dice game known as "Farkle" and is working on analyzing the probabilities for outcomes when 6 dice are thrown. I had worked on them earlier but had set the problem aside. I believe I have cracked it now, for outcomes up to 6 dice at least.
July 22, 2009:
Ready, set, go! Today's
Drag Strip Tree
simulation program posted our Delphi Techniques section illustrates the use of
timers to control sequential events.
July 29, 2009: FrontPage, Microsoft's previous tool for website creation, and the one I use, is at the end of its life cycle. I have delayed converting to another program partly because I don't have much interest in being a web site developer, and partly because Microsoft (nor anyone else that I know of) provides a conversion tool. The general conversion rule is: you can save the text, but discard everything else and start over rebuilding your site. Not something I look forward to.
One of the symptoms of "end-of-life" is broken/disabled features as host sites lose knowledge about FrontPage and interest in maintaining it. Currently it's the "hit counter" feature at the bottom of this page that stopped working sometime after March 31. It may be fixable, but in the meantime I wanted to recover the usage count data for the 2nd quarter. Today's program, Offline Hit Counter, solves that problem by analyzing website log files. I've filed it in the Utilities Section of DFF because, you never know, the same or similar problem may arise in the future. (By the way, there were 11,905 visits to the DelphiForFun home page in the April-June time period.)
August 5, 2009: Programming productivity is being impacted these days by garden chores, a new WII console with balance board, a new kitten in the house, and Sokoban.
If you don't know about Sokoban puzzles, check it out at Wikipedia. A Delphi user is developing a manual play version wrote asking a question which led to my finding an online version at LetsLogic.com. The site requires registration, but the fellow who runs it is just a lover of the game and has collected thousands of addictive puzzles.
I did decide to post a simple Count Clicks Demo program I wrote today for a for a new Delphi user. As the name implies, it counts and displays the number of times that a button has been clicked. Only 9 lines of user written code, but three event exit methods might make it worthwhile for beginners.
August 12, 2009:
I wrote a version of a popular game called Sokoban this week, not that the world needs another one. I'm considering tackling a "solver" for this simple but challenging game and decided I needed a simple version as a solver test bed. I call mine Simple Sokoban, but even a simple version required 500 lines of code and kept me out of trouble for another week.
<==== Simple case (Even with only 4 boxes to place on 4 targets,
they get harder fast though!)
August 19, 2009:
A sharp user from Portugal caught a design problem with our Tangram program. The source of the original design and the puzzles were from Dr. Mark Overmars, a professor at the University of Utrecht in the Netherlands who's lucky enough to make his living by teaching, designing, and, I suppose, playing, computer based games. . His version of Tangram was originally freeware but has since gone commercial. The puzzles that were part of that package have a slight problem that allows certain puzzles to have all of the pieces placed with no overlaps, but with white space left over!. Tangram Version 4 posted today, kind of addresses the issue by at least recognizing and notifying the user that this is not the desired solution.
August 24, 2009: A new version today of our GridQuickSort program in the Delphi Techniques section of DFF. A viewer had asked about multi-column StringGrid sorting the other day which led me to learn that sort algorithms can be classified as "stable" or "unstable" depending on whether they preserve the input order when equal keys are encountered. With a stable sort, multiple columns may be sorted by running multiple single column sorts from the minor keys to the major key. Quick sort turns out to be unstable, as is Shell sort, another efficient sorting method. Merge sort however fills the bill as GridQuickSort, Version 3 illustrates.
September 2, 2009:
I revisited a program from several years ago recently. Counterfeit Coin Version 2 updates the program to let you (or shows you how to) solve the problem of determining which coin in a stack of 12 has a non-standard weight in 3 or fewer weighings on a balance beam scale. You can hone your skills with smaller stacks of coins and with the added information about whether the bad coin is heavy or light. Stacks of up to 9 coins are quite straightforward. Taller stacks with the direction of the weight error unknown are tough to solve in 3 weighings though.
September 12, 2009:
I have been preoccupied lately with getting up the winter's firewood and setting up my latest laptop.
The new laptop is a "refurbished" Dell Studio 17 - Ruby Red, 4GB memory, 320 GB hard drive, 1920X1200 17" RGB LED display, $636 from the Dell Outlet store. Bargains are available from time to time if you're patient. It's heavy, but the increased display area makes things easier on these old eyes. I've ordered a 2nd hard drive to install internally in this machine, so space and backup hassles with the old one should be resolved also.
Here's another 30 line beginners program, Beginners: Digit Sums ,which counts the number of integers of a given size whose digits add up to a given value. Digit Sums is probably not of much value except as a programming exercise, but I can tell you now that there are 120 four-digit integers whose digits sum to 8. The program doesn't display this, but I'll bet that 1115 is the smallest and 8000 is the largest (Or, as Jeff B. pointed out, perhaps it is 1007 is the smalles) .A couple of extra lines of code would let us display this information also.September 19, 2009:
It's a great occupation or hobby that lets you learn something new every day. This week, thanks my new high resolution laptop, I learned something every day about DPI Scaling. This is a Windows rendering technique which allows text and most drawings to appear larger (or smaller) than the program thinks they are. It is a clever way to account for monitor displays that have high resolution measured in "Dots Per Inch" (DPI) but results in text too small for comfortable reading. It turns out that the default options for Delphi programs are not the best when scaling is applied so many will require eventual reposting. The most obvious symptom is scroll bars appearing on forms which could easily be enlarged to eliminate them. The first two fixes applied today are two that I use most often as puzzle "helpers": Brute Force and Word Stuff 2.
September 24, 2009:
Here's a simple 25 line program that performs quite a sophisticated test. The puzzle is from the Mensa Puzzle-A-Day Calendar for yesterday, September 23. It presents text requiring us to find the word that meets the requirements given and whose letters appear consecutively but in reverse order. Reversed Words was added to the Beginner's page of our Delphi Techniques section.
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 rectangle 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.
The mathematical probability of a common cat doing exactly as it pleases is the one scientific absolute in the world. - Lynn Osband (Consultant)
To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm
290,000 home page visitors since Sept 2000. 257,000 program downloads in the past 12 months!
Copyright © 2000-2017, Gary Darby All rights reserved.