April 3, 2011
Delphi For Fun Newsletter #59
In our last newsletter, I was lamenting the fact that Embarcadero had not released an affordable "Learners" version of Delphi. I can't take credit, but in late January, they did release Delphi XE Starter, a modern version priced at $150; not cheap but reasonable enough these days for the student or serious hobbyist. It has most of the functionality of the Delphi XE Pro version, lacking some of the more advanced features that I will probably never miss. The program is available at http://www.embarcadero.com/products/delphi/starter and there is more available online ( see especially http://www.blaisepascal.eu/ for a review and the Delphi DocWiki at http://docwiki.embarcadero.com/RADStudio/en/Main_Page which has a lot of Delphi XE, articles not specifically for the Starter edition, but probably mostly applicable) . For registered users, Bob Swart's 154 page book "Delphi XE Starter Essentials" is available as a free PDF file download at http://cc.embarcadero.com/item/28214. Feel free to skip Chapter 2 Language Enhancements), but I found Chapters 1 (XE Starter IDE), 3 (RTL and VCL Enhancements), and 4 (Unicode) to be potentially useful.
I'll be sticking with Delphi 7 for most of my code since it appears that XE is very compatible with programs written with D7. Understandably the reverse is not true since XE has some new and many enhanced controls. I haven't used XE much, but plan to play with it as time and interests allow. I'll post the interesting bits I run across and invite readers to send feedback on your experiences.
Spring is just around the corner - the daffodils and forsythia are in full bloom and seem to be surviving the 30 degree overnight temperatures. Soon no more excuses for staying indoors and coding instead of working outside, (which is probably healthier anyway). We have grandchildren's high school and college graduations coming up in a few weeks and more travel planned, so it will be a busy Q2!.
On the programming front, three biggies, "Reaction Times", "Gunport Domino Puzzle", and "LPDemo", occupied the lion's share of my time - see details below. As usual , I squeezed in a few fairly useless "just for fun" programs as well. Here's a summary of the new and changed programs since last time.
January 1, 2011: We're back from a week's cruise in the Western Caribbean with family; round trip from New Orleans visiting Costa Maya, RoaTan, Belize, and Cozumel. We did the typical tourist stuff I suppose: visiting Mayan ruins, zip lining, beach and hot tub time with the grandkids, taking a Mexican Cooking class, and souvenir shopping. All the more enjoyable because Grandma and I were with kids and grandkids, Can't wait to start planning the next one!
January 6, 2011: A viewer recently discovered that
the default file names used to store reaction time results in our "ReactionTimes"
program could not be changed, even though the program should allow it.
I'm sure that they worked at one time so the Version 3.0 probably broke it.
ReactionTimes Version 3.1
posted today should have it fixed.
January 13, 2011: Here's a nice little puzzle program that kept me busy for a couple of days this week while staying in out of the cold: Given 7 heads up coins, reverse them to all tails up by reversing 5 coins during each turn. ReverseCoins attempts to solve the puzzle for a range of total coins and coins to be reversed in each turn (not all combinations are solvable). Oh, and user play is supported also.
January 14, 2011: The October 3.4.2 release of our CutList program fixed one problem, but introduced another. Existing user manually arranged solutions could be updated OK but new ones could not be saved. CutList Version 3.4.3 released today fixes that problem.
January 21, 2011: The
Gunports Domino Puzzle requires dominoes be placed on a board leaving the
maximum number of empty surrounded single squares (the gun ports). This initial version
allows user play on a set of predefined board sizes but watch this space for
user defined boards and a solver (I hope J).
January 31, 2011: Linear programming is a technique for solving a large class of optimization problems which can be described by a set of linear equations. For example, A potter is making cups and plates. It takes her 6 minutes to make a cup and 3 minutes to make a plate. Each cup uses 3/4 lb. of clay and each plate uses one lb. of clay. She has 20 hours available for making the cups and plates and has 250 lbs. of clay on hand. She makes a profit of $2 on each cup and $1.50 on each plate. How many cups and how many plates should she make in order to maximize her profit? Today's program, LPDemo, posting in our Delphi Techniques section provides an introductory interface to a free linear problem solver, LP_Solve. It displays (and solves) several included sample programs as well as the ability for the user to enter and solve additional simple problems.
February 1, 2011: Red letter day! A reasonably priced "Starter" version of Delphi is available! Delphi XE Starter Edition is $149 (or apparently $149 Euros) if you have any prior version of Delphi (or almost any other development package). See http://www.embarcadero.com/products/delphi/starter for details.
I downloaded mine yesterday and tried converting LPDemo as a first test. There is a small problem with a different default string format which will only show up if single byte character sizes are assumed. LPDemo happened to do that but LPDemo Version 2.1 posted this evening seems to fix the problem.
I'll be working (slowly) on recompiling the several hundred DFF programs under Delphi XE and will likely create a page or section of the DFF website with conversion and compatibility notes. I especially invite feedback on your experiences with this long awaited new version.
February 7, 2011: A couple of times each year, I get an email from a student or teacher using our "Reaction Times" program to conduct some study or experiment. Sometimes they merely have questions about using the programs; sometimes the need modifications. That was the case with a team of graduate students at a Danish University Hospital who are using the program to study fatigue effects on stimulus response times for recovering stroke victims. Today's posting: ReactionTimes Version 3.2 implements a few commonsense features that should help them.
February 12, 2011: Onve in a while create a small program that I write just because it's the surest way to find the answer to some puzzle or problem I run across. I post some of these in our Beginner's page in the Delphi Techniques section of DFF. Here's the latest example, Pecking Order, where writing the 30 lines of code to solve it just seemed easier than doing the algebra:
Four sparrows found a dish of seed,
22, 2011: Maze, Version 3.1,
our maze puzzle generator/solver program was posted today. No functional
changes today; it just fixes a minor bug which prevented erasing all
intermediate path segments when a user
"backtracked" to a previous point with a mouse click.
February 25, 2011: One of the oldest and still one my favorite programs on the site is Brute Force. It uses exhaustive search to solve systems of linear equations with solutions restricted to specified integer values. It's surprising how many puzzle problems meet these conditions, Brute Force Version 2.5 adds the "mod" remainder operator to help find a six digit even number that must meet some other conditions, but the "even" condition is the one that mod helps determine (the equation F mod 2 = 0 defines is the constraint that F be even).
March 12, 2011: GunPort Domino Puzzles Version 2 was posted today. The puzzle requires dominoes be placed on a board leaving the maximum number of empty surrounded single squares (the gun ports). Version 2 adds program solution searching to the original version which allowed user searches only. It also allows board sizes from 3x3 to 12x12. It's been a challenging, educational, and satisfying 2 week project which has put me behind on a couple of other projects, but I could easily spend that much time again exploring ways to improve the search algorithm. Coming back to a spare computer and seeing a solution posted after 13 hours of run time was satisfying and fun!
March 21, 2011: Our Reaction Times program has seen more use in educational environments than I could have imagined when I wrote it. Originally intended as a Science Fair project for a granddaughter, it's been used in Statistics classes in California Community Colleges, by university students such as those mentioned in the February update to help study response times of stroke victims at a Danish hospital. and most recently engineering students at the University of Singapore. Reaction Times Version 4 includes a new type of response: JPEG images are displayed in a chosen sequence and detail records written for each image, even if the response was early or late. This will let the team associate specific images with response times in their project about signage recognition. There are also a few enhancements for the Danish guys to eliminate load time for a specific audio file to see if their observed 40 ms lag between audible and visual stimuli is due to file load times.
March 13, 2011: It didn't take long to produce the next Gunport's update . Version 2.1 upgrades the LPSolve solver module from V5.1 to V5.5 which looks to be significant faster at finding solutions in the cases I've run so far.
March 18, 2011: The only problem with having users of my programs is that they keep finding bugs!. Just kidding, I enjoy fixing problems because each few minutes invested makes the program just a little bit better, permanently. Maze, Version 3.2 fixes another path drawing problem, and GunPorts Version 51.2 reverts back to LPSolve V5.1 due to problems with V5.5 and also adds user access to some additional options that I'm using to investigate solving times when the program is searching for solutions.
March 23, 2011: Help! I'm working on this program and just can't stop! I decided to reorder the variables fed to LPSolve in GunPortsVersion 51.3, so the the Horizontal, Vertical, and Monomino binary variables for each cell are interlaced. This has reduced solving time dramatically in most cases. The 7x7 case is now solved in 3 seconds compared to 2 hours for the previous version. The10x10 board search which previously ran for 49 hours before I stopped it, has not yet been rerun. I am , however, proud to now include an optimal 10x10 solution found manually by overlapping a 4x10 solution whose last row pattern happened to match the top row pattern of a 7x10 solution. "More than one way to skin a cat" as we say here!
March 30, 2011: I finally had a chance this past
week to work on a "just for fun" project.
solve another puzzle from my
2011 Mensa 365 Brain Puzzlers Calendar. I posted it our Delphi Techniques
section because it provides interesting examples of depth first searching,
drawing on a grid, and generating non-uniform distributions.
To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm
340,800 home page visitors since Sept 2000. 275,500 program downloads in the past 12 months!