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

 

October 2, 2013

Delphi For Fun Newsletter #69

Fall is in the air, after a summer with extreme rainfall in August instead of extreme heat.   The firewood supply for this winter is mostly mostly complete and the site for the new garage is ready for the delivery of the pre-fab in a couple of weeks.  We purchased a Ford C-Max in June, deciding to become a two vehicle family, keeping our AWD  (All Wheel Drive) Mountaineer for the snow and ice to come.  It will reside snugly in its own new garage between outings.    The C-Max is getting 44 MPG so far;  not bad for having to descend (and climb) 2500 feet to nearest grocery store.  That's enough to make it vehicle of choice, weather and required capacity permitting.          

  Significant projects planned for this quarter include:

  •  A comprehensive review of our UAstronomy unit to find the bug that puts my Autumnal Equinox calculation 7 minutes earlier than the US Naval Observatory's Almanac date and time.  I envision a regression test program  to verify my code, routine by routine, against the original source.

  • Also a program to draw and print the multi-grid diagrams commonly used for matching variables with values when  solving Logic puzzles manually. 

Below are links to the the 3rd quarter projects.

---------------------------------------------------------------------------------

July 9, 2013: Key Scan Codes Version 3.1 posted today today fixes a problem introduced in V3.0 in the "Last Key Pressed" display.  When  there is no symbol associated with a key, the key name is displayed and long key names could overlay the "Caps Lock" and Num Lock" status displays.  Also this version  shows the symbol rather than the key name for punctuation and other special keys which have an associated symbol.  

July 10, 2013: 

Generated Sudoku with 22 given values

Our Sudoku program is a helper, solver, and generator for that popular puzzle type.  Like most of my programs, I wrote this one because it seemed more fun and less tedious than solving  Sudoku puzzles by hand.  There are dozens of similar programs around, but none in Delphi that I was aware of at the time.  In any event, I had fun writing it and was quite satisfied with the "helper" functions which allow users to enter and solve puzzles, and see "hints" about which number might fill empty cells. The program  could also generate random puzzles with a specified number of "given" or empty cells.  The generation task is the toughest nut to crack as the number of given cells gets smaller and the number of possible solutions to check for uniqueness increases.   Sudoku Version 4.0 posted today implements a new search algorithm which reduces the feasible lower limit from 28 to 23 pre-filled cells.  The absolute lower limit for a puzzle with a unique solution has been proven (not by me!) to be 17 givens,  so our work is not yet finished but we are one step closer today.
 

July 17, 2013:

I spent a few more days working on  Sudoku Generator V4.1,  posted today,  which finds  puzzles with 21 filled cells (down from23) after several minutes of searching.  Two puzzles with 20 filled cells were generated but the longer solve time for the one shown here was an impractical 4 hours.  Reason enough to put it to rest for now.   
 

         

 
 

July 24, 2013:  375 years ago Pierre Fermat conjectured that no two integers raised to power N could sum to an integer raised to that power for N > 2 (Fermat's Last Theorem), e.g. no sum of two cubed integers can ever sum to a cubed integer.   It took 350 years for someone to prove the conjecture really was a theorem applying to all positive integers.  It is called "Last" because it was the last of his asserted theorems to remain unproven for many years (until 1995).  In 1769, Leonhard Euler, while not having proven Fermat's Last Theorem,  had found a sum of 3 cubes which was the cube of an integer and published a generalized conjecture that at least k integers were required if the sum of their kth powers was itself to be the kth power of an integer.   This is Euler's Sum of Powers Conjecture.  It took almost 200 years before the first counterexample was found in 1966.  I decided to try to to find it myself and Euler's Sum of Powers program, posted today in our Math section, does find the 5th power counterexample in about 8 seconds using a direct search technique.  A 4th power counterexample was found in 1988, but the numbers are too large to be found by my program in its current form.  To date, no counter example has been found for powers greater than 5 so I don't have much hope that this will be the tool to do it.  But it will find all the Pythagorean triples (a2 + b2 = c2) that one could ever want!   Oh, and the program makes it easy to recognize Plato's number;  the smallest (only?) sum of cubes of 3 consecutive integers equal to the cube of the next (4th) consecutive integer.   Fun!    

 

July 28, 2013:

Our "Brain Games" daily calendar puzzles are usually pretty good, but the author of this one thinks that "Cyclist" is the only answer.   Writing a program seemed more fun than simply turning the calendar page over find the solution.  A 50 line beginner's level program performing a search of our 62,000 word dictionary finds the solution quickly -  all 211 of them!  Boy, did the Brain Game guy get this one wrong!  Check out Word Search, the latest addition at the bottom of the Beginner's page. 
 

August 13, 2013:  The Challenging Math Teasers program posted today implements  three problems of the 100 presented in the "Challenging Mathematical Teasers" book by J.A.H. Hunter  and published by Dover Publications. The puzzles generally require math techniques beyond simply solving an algebraic equation or two. The three presented here were chosen randomly are easily amenable to programmed solutions (and have relatively short descriptions :>).  By the way, the above book link to Amazon offers a number of good used copies for $0.01 + $3.99 shipping,  if you reside in the U.S. and act quickly.

The program is a one day effort while taking a break from the "Find All Polygons" program I have been wrestling with for the past two weeks.   Who knew polygons could be so hard to find?

I placed this program in the Math Topics section of DFF but also indexed it under Delphi Techniques and Beginners categories since it does illustrate some useful number manipulation techniques with less than 20 source code statements to handle each of the 3 problem buttons.  

 

August 22, 2013:

Simple case: How many polygons can you find embedded here?

After a month of on-and-off effort, here is Find All Polygons, a program to look for polygons, closed figures formed from connected straight line segments.  According to Wikipedia, "Polygon" is derived from Greek with literal meaning "many corners".  Typically, but not always,  the number of corners, (vertices), equals the number sides (edges).  I learned much about them in the course of writing this program including the many ways that  arbitrary closed sets of  of lines may not be valid polygons.  The program analyzes several different sample figures including one from which several hundred polygons can be selected.  Needless to say, I have not examined all of them so there still may be polygons missed or non-polygons selected.  Let me know if you find errors.  
 

August 26, 2013:

  16 "Primitive" triangles, (out of 46 total!)

 Find All Polygons, Version 3.2 posted today is better than last week's posting at finding all polygons at a given search level.  When I added the figure from our "How Many Triangles?" program to this program, I realized that some of the  interior nodes (created when interior lines intersect) were not being examined during the polygon search.  The problem is corrected today.  The easily checked polygon counts (the Tennis problem's rectangle counts,  the Triangles problem's triangle counts, and the the primitive counts for any figure are now correct.  (Total rectangle and triangle counts are found by limiting "Max Search Depth" values to 5 and 4 respectively.)
  
September 1, 2013:  I had an interesting email conversation a few weeks ago  with an older gentleman who programs in Delphi as a hobby and was having some trouble with bitmaps and making the mouse interact with a StringGrid.  I was able  to help him and decided to post this program, String Grids and Bitmaps, in our Delphi Techniques section to pass along what we both learned. 

 September 8, 2013:  George has provided another opportunity for me to teach (and learn) Delphi programming techniques this week.  His problem was how to sort several hundred file names with embedded numbers so that numeric values were honored.  The default lexicographic sort arranges these sample files names as ( A1.gif, A10.gif, A1A.gif)  because comparisons are made left to right and in the 3rd position "." comes before "0" comes before "A".   Delphi's TStringList component however has a CustomSort feature which allows us to sort in the desired sequence as (A1.gif, A1A.gif, A10.gif).  Program CustomStringListSort illustrates how it can be dome.   

September 21, 2013:

My British friend, George, has provided material for all three projects this month. Here is a "Delphi Techniques" program, Blend Drawing Demo, which explores his latest problem: semi-transparent shading of a selected quadrant of a TImage bitmap.   Extensions added features to control blend color, intensity, location, and speed "just for fun".
 


This is my 75th year and reminders of that are occurring more frequently each year.   Below are few relevant quotations about aging but the one most pertinent to me doesn't even mention age.  It's the "Irish Prayer" which says "Change what you can change, accept what you can't change, and be smart enough to know the difference".   I believe I am.

  • Age is an issue of mind over matter. If you don't mind, it doesn't matter. ~Mark Twain

  • Growing old is mandatory; growing up is optional. ~Chili Davis

  • Men do not quit playing because they grow old; they grow old because they quit playing. ~Oliver Wendell Holmes\

  • The true way to render age vigorous is to prolong the youth of the mind. ~Mortimer Collins
     


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

357,300 site visits and 284,770 program downloads in the past 12 months!