Home  |  Introduction  |  Newsletters  |  Programs  |  Feedback

 

 

Search:

WWW

DelphiForFun.org

Support DFF

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

If you shop at Amazon anyway,  consider using this link. 

     

We receive a few cents from each purchase.  Thanks

 

 

The index page for all Programs on the site?

The DFF Play CD?

Zipped file DFF Play CD.zip contains  executable version of about  75 of the 200+ programs from the site, mostly those I particularly liked or thought would be of widest interest for non-programmers.  The file is rather large, about 20mb..

Anything else?

 

Google
 

 

    

Search WWW

Search DelphiForFun.org

 

Not a programmer (yet)?

 That's OK -  the executable version for any puzzle or  game you find here is available for download.  Just scroll down to the bottom of most any description page and you'll find a "Download executable" link. Downloaded programs are in "zipped" format to reduce size and may require an "unzipper" program unless you are running Win XP or later.  Here's a link to a free one. 

Check  out  the Most Popular  Downloads from DFF   (updated weekly)

First time visitor?

Take a look at the Introduction page to see what this site is about

Notes for Teachers

 

 

Delphi For Fun Newsletter #43                                                July 31, 2006

 

Summer is half gone and, as predicted, programming activity has slowed due to outside work.  This is the year that I’m determined to keep the weeds down in the garden.  So far, so good, although I’m strongly considering one of those mini garden tillers to ease the hand hoeing task.   

 I’ve finished re-reading The Lord of the Rings series and I’m about halfway through the Harry Potter series for the first time.  Just trying to keep up with the grandchildren.   I also purchased the academic version of Borland’s Developer Studio 2006 Professional which includes Delphi 2006 (Windows and .Net versions), plus C++ , and JBuilder (Java) compilers.   Students, teachers, and employees of any educational institution qualify  for the hugely discounted price (under $100!).    If you are not one of those, you probably know someone who is.    I’m also reading Marco Cantu’s Mastering Delphi 2005 text.  He’s quite readable and very thorough.  There’s no denying though, that H. Potter’s adventures at Hogwarts are more fun to read.

 

In the spare hours, here’s what was posted since our last newsletter:  


February 26, 2006:  We have been neglecting puzzle programs lately, but we'll be correcting that in the coming weeks.   I finally got around to browsing though one of the books I received for Christmas (The Giant Book of Mensa Mind Challenges) and found several good candidates in the first few minutes.  The first  posted today is Added Corners:  "Place the digits 1..8 in the 8 figures so that each square contains the  sum of the numbers in the adjoining circles."

  

 

February 28, 2006:   Oscilloscope Version 4 posted today adds a dual trace function using stereo input signals.  Plus,  the visual layout has been improved  to appear more "oscilloscope-like".      Many thanks to "Krille", a  sharp Delphi programmer from Sweden for doing most of the work on these changes. 

 

 

 March 2, 2006:  We're heading out in the morning to spend a week visiting Colonial Williamsburg and celebrating birthdays with family (my 67th and grandson Nathan's 2nd).  Word is out that the "Terrible twos" have kicked in early, so we'll see how  it goes. 

In any event, here is one more little puzzle program from the Mensa Mind Challenges book, (I just noticed that there are a few of these for sale at Amazon in the $5 range - a good deal).  The puzzle is called Digit Tree.  It sets the task of entering digits 1 through 9 into a network of 7 circles so that the value in any circle is the sum of the connected circles below it. 
   

 

 

March 12, 2006:  Back from a pleasant week "off-property".   Colonial Williamsburg in the slow season has the advantage of as much one-on-one time with the craftsmen as you care to spend, plus lodging  at   good rates ($110/per night for a 2 bedroom suite including breakfast and Williamsburg admission passes!)    Nathan's 2nd birthday was a success with only an occasional test of that new found sense of independence.  You could see the defiance wheels turning when the "Stop that" command conflicted his planned actions.  Fortunately, his Mom gets to handle those situations.  

Catching up on the Mensa Puzzle calendar when we got back, I ran across a decryption problem that prompted today's Simple Decrypt program posting to the Beginners page of our Delphi Techniques section.   It implements a shift cipher (also known as "Caesar's Cipher") in about 40 lines of Delphi code and which will encrypt or decrypt input text. 

March 19, 2006:  I spent so much time working on the Probability Calculator this week, that the  wife has been making sarcastic comments about "planning a trip to the garage".  Well, the program is posted now, so tomorrow  I may even go to town with her and treat her to lunch.   

It has been fun and educational, and the result may even be quite good - only time will tell.   If you are into math things, check it out and let me know.  It is not a tutorial,  but addresses a range of common probability type problems from easy to perhaps intermediate, and should be at least handy for checking results you may calculate with pencil and paper.  

March 20, 2006: Danijel Tkalcec  has started a website to promote Delphi programming at www.fundelphi.org  and a discussion group at  http://groups.google.com/group/fundelphi .  I've had a number of requests in the past to start a discussion group for DFF programs, but have avoided it because I like writing code better than writing about code.   You're invited to take a look and participate if so inclined.    The website has a rapidly growing list of other Delphi related sites  for you to explore.   Good luck to  Danijel.

March 23, 2006:  Here's and updated version  of our Inverted/Mirrored Text program which lets users set the background color.  This will be useful to those using the program as a teleprompter and wanting white text on a black background.  

 

$1000 Reward!

March 26, 2006:  The 15 Puzzle was popularized by puzzle maker Sam Loyd in 1870 when he published an unsolvable version in a New York newspaper offering a $1000 reward for a solution.   Many hours were spent in fruitless attempts.  It turns out that only 1/2 of the possible configurations are solvable even though a  DFF viewer recently tried to convince me otherwise.  Here is version 3 of our Sliding 15 puzzle which will let him "cheat" by exchanging adjacent tiles.  The resulting failure  to solve and   a "Parity" function are not proof,  but pretty convincing evidence.   
 

April 2, 2006:  Most every year, a student or two uses our ReactionTimes program as part of some project and writes for help or to report a bug.  This year a bright high school junior is testing aural vs. visual response times as his  Advanced Biology project.  I posted a version  today that adds sounds to the trial type choices.  Good luck,  Brad.   

April 9, 2006: 

The young math professor noticed one day that this subset of his calculator's keys could be read as an equation, but not a valid one.  However, by exchanging a couple of pairs of numeric keys he could make the equation valid.  Can you find the 2 pairs of keys that he swapped?  Here's another puzzle adapted from the Giant Book of Mensa Mind Challenges  book. and posted today as the Calculator Keys Puzzle


 

 

 

 

April 13, 2006: The problem of covering a given set of points with the smallest possible circle is interesting.   I published a program to solve it several years ago.  A viewer wrote today with a question about applying the best algorithm for solving the problem (not mine, but one used in the program) for a collinear set of points.   The algorithm handles the case but my program didn't like my code to scale collinear data for plotting.  Version 2.1 of the  Circle Covering Points program was posted today which fixes that problem and makes a number of other enhancements for the way that test data is entered and saved.

 

 

April 30, 2006:  We'll squeeze one more program in this month.  Spring duties like garden preparation, clearing some stumps and brush from under the power lines, and getting back to the woodworking shop have slowed "production", but it does seem good to get outside with decent temperatures.   Here's a  Drag/Drop Image Demo program written to solve a sub-problem of an upcoming "human intelligence" version of our Cutlist program.   The idea is to let users drag and drop images of required parts onto available supply piece images for woodworking projects.   The current Cutlist version searches for good ways to accomplish the task by trial and error with some success.  But there are cases where the program it is not smart enough to produce the best result.  The new version will let the user take a crack at finding a satisfactory layout.  This demo, posted in the Delphi-Techniques section,  just addresses the mechanics of dragging and dropping images from one scrollable list (required pieces) to another scrollable list (of available supply pieces).   

April 4, 2006:  My  learning curve has steepened this week as I tackle two new ventures.  I'm installing my first Windows  Server (2003) at home as I write this (lots of wait time in the process).  No real good reason for the install except to make files and email more accessible from any of the four computers scattered around the house.  So far so good.

The other new experience will be to fool around with Delphi for .Net, the version that natively knows about online coding.   If you live in the USA and are a student, have a student,  or are otherwise associated with an educational institution, the academic version of Borland Developer Studio 2006 Professional is available for under $100.  A heck of a bargain!  It includes two Delphi compilers (Win32 and Delphi.Net) as well as C++ Builder  and C# Builder compilers.    Granddaughter Kaitlin recently acquired a copy (as a "gift" which she has kindly let me check out first :>).   I'm about 80 pages into the best current Delphi book:  Marco Cantu’s  Delphi 2005.  He has a good understanding of the material and a very readable first person writing style that has kept him at the top of the Delphi authors club for years. His website has the Delphi 2006 update and chapter by chapter source code for all of the examples in the book.   

On the more mundane side, I've been doing some housekeeping, and decided it was time for a new version of the DLL Library (DFFLibV06).  For information about the idea and  motivation for a common library file, click here.

 Changes are:

·         The UBigFloatV2 large floating point arithmetic unit has been moved to the library. 

·         The  BigfFloat test program has been relocated and has an additional test added for the "Compare" operation.

·         UParser10, an arithmetic expression parser/evaluator used in a couple of calculator programs was moved to the library. 

·         UBigIntsV2 has  new FastMult and FastSquare procedures written by regular contributor, Charles Doumar, for very large integers.  About 2 ½  times faster than Mult or Square for 100,000 digit numbers. (1.4 seconds vs. 3.5 seconds on my laptop)..  12 times faster for 250,000 digits.   I reposted the BigIntsTest program  with an added button to  time the results for random integers of specified size.    

·         A new "FreeAndClear" procedure was added to the DFFUtils unit.  It will release any objects associated with string lists in TStringList, TMemo, or TListBox controls as well as delete the string items.   Objects in string lists are a nice feature, but the standard Clear method does not free the objects (with good reason, you may not want the objects released if they are used elsewhere).  On the other hand,  not freeing objects when you are finished with them can lead to a major memory leak and freeing them requires writing code to loop through each entry.  FreeAndClear solves this for you.   

If you find any Type 1 (commission) or Type 2 (omission) errors in all of this, let me know.     

May 4, 2006: Frustrated viewer Delores just wrote asking if it were possible to solve the Seven Coins puzzle.   The answer is, probably not,  if you just had the abbreviated (and confusing) description provided on the web page and did not download the program.  The instructions from the program have been transferred to the web page which may help her sleep tonight. 

"Place a coin on any unoccupied star point connected to another unoccupied star point and move it to the other end. Can you do this 6 more times so that 7 of the star points are occupied?"

May 8, 2006:  For programmers, a new TCountDown timer class I wrote for the usual reasons - I wanted one with one second resolution  for a timed puzzle project and could not find a good, free, Delphi version online.  Countdown Timer Demo includes the new control and a program illustrating  usage for both analog and digital versions.

 May 11, 2006:  I spent most of this week working on a stupid logic problem a user sent me.  "Stupid" because I haven't solved it yet.  In fact, it seems one particular clue makes it unsolvable.  I'm researching the source of the problem, but either way, I'll probably post a page about it one of these days.   It's called "Traveling Men" and involves 6 men with 6 first and last names, 6 occupations and each having uniquely traveled by 2 of 5 modes of transportation.  If you have any information about it, please send feedback.

I did post a couple of small changes to other programs.  The dictionary maintenance program, DicMaint, part of our Wordstuff series, was corrected to properly flag capitalized words if the dictionary file was saved as a plain text file.  A new, faster, routine to extract words from input text was also implemented.

Another viewer pointed out that our Set Partition program in Math Topics, did not return results for the single element case.  The set {a} has only a single partition (of course}, but the class that returns partition information should handle it.  It now does.    

May 14, 2006:  Well, the "stupid" logic problem has become "could have be more clearly written" after it succumbed to much study.    Traveling Men describes the problem and has download links for the program I wrote to speed experimentation with facts and rules extracted from the problem text. 

May 19, 2006:  A bug-fix version of CutList (Version3.2.1) was posted last week to fix  printing & display problems when parts diagrams exceeded  one page.   Cutlist is a program to find efficient ways to layout  required parts for a woodworking project using a list of available supply pieces.

 

Here's 1 word of 121 found by Akerue.  How many could you find?

May 24, 2006:  Here's Akerue Version 4 , a word search game where you try to find more words in a square letter grid than the program finds.  (Actually, the program finds them all, but he only takes credit for the ones you don't find.)   This version adds keyboard input and a game time limit,  features that a small but dedicated group of Akerue players have been requesting for some time.   I also added a couple of my own including the ability to define additions and deletions for predefined wordlists.   
 

May 25, 2006:  One more version of Cutlist, Version 3.2.2 will do it for this month.   The program has real users designing real projects, and finding real "bugs".   Today's version adds the ability to print the "leftover parts" list and a new option to select what parts of the project to print.   I also corrected a problem when part name items exceeded half of the available page width.   List was printed in two overlapping columns, making it hard to read.   These cases now print in a single column.     

June 1, 2006:  Two guys, Ted Blumberg and Jeff Bratt have taken care of my spare time this past week by being actual program users.   Ted is a designer for First Source Products in Johnson City, TN .  He used Cutlist to plan layouts some bed frames he is making for personal use  and likes those multi-page printouts (which should now work).   Jeff is a programmer/photographer/woodworker who spent time this week playing with and finding bugs in Akerue.   Cutlist 3.2.3 and Akerue 4.1 are the results of their feedback.  

June 12, 2006:  We're back from a week in Huntsville where we enjoyed 12 year old granddaughter Sarah in a dance production.  What a cutie!  And smart enough to find program bugs in word search program Akerue and the tricky hangman program,  Hangman2 in her spare time between rehearsing and performing.   Akerue somehow would not allow words to be added to the "Added Words" list for valid words not in the dictionary.  At the easy level, Hangman2 did not allow 3 letter words and hung the "convict" in 10 moves instead of the 12 advertised.   Both programs have been fixed as of today.    

June 21, 2006: I've been busy for the last week or so, but not to much to show for it yet.  I have a running version of a "Delayed Column Generation" program which solves the "Cutting Stock" problem - cutting lengths of material of specified lengths from stock material of a specified length.  The "columns" in this linear programming problem represent the possible patterns for cutting the material from the stock pieces.  The complication is that the number of these patterns increases very rapidly as the number of required part lengths increases.  Delayed Column Generation solves the problem by starting with an imperfect, but easy to find, solution and systematically adds "columns" (other possible ways to cut the stock) until no further improvement is found.  Still need to document this and perhaps find a way to produce integer only solutions for the number of stock pieces required.

Another program waiting documentation solves the "CoalToDiamonds" puzzle.  A 3X3 array of "Coal lumps" is turned to "Diamonds" by passing through 2 intermediate steps.  Clicking changes an item to the next step, but it also changes he other items in that row and column to the next phase (including Diamonds which convert back to Coal).   Changing an array of 9 coal lumps to 9 diamonds requires 16 steps, almost impossible  for mere humans.  There are over 264,000 start puzzle configurations of which 16,384 can be solved with 1 to 16 moves required.  Again, I just need time to do some documentation for this program before posting it. 

I did however post an update to the Countdown timer class so that I could use it to track run times for the various search methods used to solving CoalToDiamonds.  The timer now counts up as well as down and is more accurate than version 1 when running on a busy computer.   

Oh, and there was a new Project Euler programming problem  last week involving "Addition Chains", a set of integers from 1 to some N with the property that each number in the set is sum of 2 other numbers in the set allowing reuse.  (1,2,3,5,10,15 is one example.)  There are lots of interesting questions about how many ways there are to get from 1 to N, which is the shortest, etc.   There are now about 40 people (7 Delphi programmers, including "delphiforfun", me) that have solved all 122 problems.    A few years ago I posted the  first 10 even numbered Project Euler  problems, if you want to try your hand and need help.

We have family visiting next week, so may not get much more programming done until July.     

June 23, 2006:  The Clock Angles Puzzle, posted a few years ago asks for the number of times that clock hands are at 90° angles in a day.  The equations given to calculate the times were accurate but confusing to another viewer recently.  I just posted a table of the values which may help clear  things  up.   

July 6, 2006:  Here's an email I received recently:

"Hi I have been searching the internet for a trick using square cards  (or paper) with numbers and holes in them. The trick was to choose any  number on the cards and one at a time turn each card to "yes" or "no"  written on each card depending what cards have that number. after that  the pile is to be turned over and the chosen number is shown through a  hole on the bottom of pile. Do you know How I might search the internet for this?

Any help would be appreciated.  

Thanks,   Peter

 

 And here is one card of the Binary Card Trick solution I came up with:
 

  

 

       3 move case

July 17, 2006:  Lots of fun this week exploring a new puzzle, Coal to Diamonds.   The objective is to change 9 lumps of coal in a 3 x 3 grid  through 2 intermediate phases and finally to diamonds as you click on them.  And, of course, a clicked diamond changes back to coal.  The catch is that each click changes not only that piece but the other pieces in that column and row.   I think that this  makes it humanly impossible to solve the 9 coal to 9 diamonds case which takes at least 15 moves.  I can solve 3 move cases easily, 4 move cases most of the time, and 5 move cases not at all.   You can set up specific initial boards or random moves that can be solved in the number of moves you specify.   The program solves cases using one of 3 "graph searching" techniques.  

Just as interesting for me was exploring the game parameters.  How many starting positions are there?  Can they all lead to the 9 diamond board?  Do any other positions require 15 moves to solve?  Do any require more than 15?  What is the distribution of games lengths?  Download the program and find out. 

  July 21, 2006:  I took a break from working the next version of CutList (which lets the user to manually place parts to be cut on the supply pieces) to  add a "write to file" button to our Big Combos program.  A user wrote asking that I increase the maximum number of displayed combinations or permutations  from 1,000 to 150,000.   But that can't  really be what he wants.  With the text file, he can browse, print, import, or whatever, with the results.

July 31, 2006:  A new version of our Cutlist program, (V3.3), which implements "Human Intelligence" solutions was posted today.  It allows users to drag and drop project part images onto supply part images if the program's  "Artificial intelligence" solution is not satisfactory.    HI solutions may be printed, saved and restored.  

 


Gary Darby

http://www.delphiforfun.org/


"What you do speaks so loudly that I cannot hear what you say." - Ralph Waldo Emerson

 

"Even if you're on the right track, you'll get run over if you just sit there." -- Will Rogers


To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm

156,000 home page visitors since Sept 2000.