April 5, 2014

Delphi For Fun Newsletter #72

One of my earliest memories is of the roadside Burmashave signs while riding with my folks in our '47 Buick to visit Aunt Pearl.  The signs  came in sets of 5, spaced about 100 yards apart.   The set that comes to mind every April  is  "Spring has sprung", "The grass has riz", Where last year's ", "Careless driver is",   "Burmashave".   Signs 1 and 2 have happened, so drive carefully!    We have been feeding about 100 lbs of corn per month (to the deer and wild turkeys), and 10 lbs of bird seed (to the little birds during the day with the bandit raccoons and a skunk cleaning up on the night shift).  They enjoy the food and we enjoy watching them.  (Well, the skunk not so much!).   We're all happy to see the end of the "starving season".  

This quarter produced a typical mix of puzzle solvers, utility programs, and updates to a couple of my favorite "oldies but goodies".  Namely:
1.) Brute Force program which  solves a large range of puzzles described by an incomplete set of algebraic equations and a constrained set of solutions, and
2.) Oscilloscope program that monitors PC audio signals and displays them on the screen. .

Here are links to all the 1st quarter postings.

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

January 6, 2014: We visited our son and family in Alabama for Christmas and spent some time playing games including Scrabble.  I'm a fairly smart guy, but most males, including me, are genetically handicapped when it comes to language skills and the girls (wife and granddaughter) beat my son  and me soundly.  Sarah's Scrabble set includes a large book with all valid words and a 3 minute timer.  We used most of our 3 minute turns frantically trying to verify that potential words were actually in the book.  That led to today's  Scrabble Search helper program.  Given a set of available letters and information about where they might connect to words on the board, the program will list legal words to choose from.   As the author, I claim the right to use it during games with family and to extend usage to other males in the game.  Now if the girls will only agree  J.

January 12, 2014: 

We're back to the Mensa Page-A-Day calendar this year and the problems are much more program-worthy than  last year's puzzle calendar.  Here's a Matchstick Puzzle from the January 2 page requiring you to "burn" segments of matches on a grid in such a way that the number of burned segments in each column and row matches given target values.  The program makes it easier than pencil and paper  to burn and "unburn" match segments to solve the puzzle.
January 15, 2014:  It didn't take long for a user to find a scaling bug in the MatchStick Puzzle for screen resolutions that don't match mine.   It is always  a problem when the program draws things (like match sticks) directly on the screen, especially when that fact slips the programmer's mind.   I believe I have it fixed for most screens with today's posting.  If not, let me know.    

January 27, 2014: A change at our host site prevented DFF site updates and it took me several days to recover site formatting.  If you run across format errors or missing or erroneous links, please drop me a line using the feedback link.   

February 1, 2014:  Adapting programs to display properly across multiple screen resolutions is a persistent problem for programs which run on unidentified remote systems.   I've made a start today by modifying several programs  to display properly on screens from 1920x1200 (my system) down to 1024x720 (likely the lowest for LED screens).  Links to changed programs are included at Screen Resolution Considerations in our Delphi Techniques section.  Please let me know if you find truncated/overlapping display elements in these (or other) programs.  

February 5, 2014:   Version 1 of the Text Search program  scanned a file and reported matches to a given string.  TextSearch Version 2.0  posted today adds these user requested features: 

  •  Ability to output to screen display, or to a user specified file name, or to both.

  •  Ability to  output selected records, non-selected records, or both.

  •  For matched records, the ability to output any combination  of
    •  the text before the matched string.
    •  the matched string, and
    •  the text following the matched string.

 

 

February 6, 2014:  An error in the FastMult (Fast Multiply) procedure in our Big Integers unit was corrected today.  The error was introduced in the November, 2013 update  and returns invalid results multiplying integers of more that 1000 or so digits.  The corrected UBigIntsV4 unit is available in today's posting in  DFF library zip file DFFLibV14_6Feb2014.  This introduces a new naming protocol for the library files to include the date and enable better tracking of minor updates. 

The  BigIntsTest program was also reposted to include the changed unit.   As a matter of interest, FastMult is 4 to 5 times faster than the regular Mult  procedure when multiplying two random 50,000 digit integers (0.46  vs. 2.1 seconds, and the results now agree)!                

February 9, 2014: 

Mensa Puzzle 2-5-14 Calendar

Brute Force is one of my favorite programs because it solves so many puzzles that can be expressed as algebra problems, including this one. We need to assign coins to the empty squares so that the sums match the given numbers.  That requires 12 equations (5 rows, 5 columns, 2 diagonals)  with 17 variables (the empty squares) with 4 possible values for each (empty, nickel, dime, quarter).        The Brute Force button found the solution in about 30 minutes  and verified that it was unique in 15 minutes more after searching all 17 trillion possible solutions. 

 Brute Force Version 3.0  fixes a problem with Incremental Solving when multiple variables can have the same value as in this puzzle . Incremental Solve works by enumerating each valid solution for the 1st equation, then testing the 2nd equation to see if there could be a valid solution given the trial solution for the 1st,  then the 3rd given 1st and 2nd, etc.  Once I fixed the problems that kept it from working on this case, the Incremental Search button finds the unique solution in 0.05 seconds and takes an additional 0.10 second to verify that the solution is unique!.  

This problem is now included (as "Mensa Puzzle 2-5-14 Calendar.prb") along with the other samples in program downloads.    
 
  ,

February 20, 2014:  The Text Search program version posted a couple of weeks ago writes lines or portions of matching lines to a file.   The fellow who requested likes the way it works, but we disagreed on what the default options should be.  Text Search Version 2.1 resolves our differences by remembering options selected from run to run.  Everyone is now happy. 

February 28, 2014:  A viewer working on a playback program for Chess games was having trouble building the keys for each rank using FEN notation.  FEN uses letters for the chess pieces (P for Pawn, B for Bishops, etc.) and numbers to represent the count of consecutive empty cells.   He didn't tell me that objective though until I had written this little demo program, Count Grid Cells which builds keys based on randomly placed letters on an 8x8 grid.  The link is to a page of beginner's level Delphi programs.  Click on the link within that page or scroll to page bottom to find the download links.

As a bonus, I finally took time to develop a simple way to remove that irritating highlight color drawn for every selected cell in a TStringGrid. I installed it for the two grids it in this program and  like so much that I plan to add it to our DFFUtils utility library  unit.  

March 6, 2014: 

Our Oil Tank Capacity Chart program displays a chart of remaining gallons for various liquid depths for a number of standard fuel oil tanks.  I recently added Version 2.1 to include a couple of new sizes at a user's request.  Version 2.2. posted today, ,allows users to edit, add, or delete dimensions of defined tanks and to print generated charts.  Fractional inch dimensions now allow my tank chart to match the nominal capacity within a gallon for all depths! 
March 12, 2014: 

Here is yesterday's Mensa Calendar puzzle which prompted today's program. My language-oriented, crossword-addicted, wife solved it in less than 10 minutes. I got two of the three words in the line 2 puzzle in 10 minutes; then decided it was programming time!

Given a word, the  Words Change 1 Letter program scans our dictionary file looking for words which differ from the base word in only one letter position.  Qualifying words are displayed.    One must still find the three synonym words from each puzzle line, but I found that I could handle that.  If you have the weird kind of mind that can visualize synonyms from words that are not quite the ones you need, you may not even need this program!  Give it a go. 

Just in case you don't already have the dictionary, both the program and the dictionary are included in the executable zip file download. 

 

March 24, 2014:

Small Medium Large
 Our SquareWordGrids  program implements the creation, user play, and program solving of Square Word Grids, an extension of our Word Squares program previously explored. "Word Squares" are square grids filled with the same set of words in both the horizontal and vertical directions.  "Square Word Grids" in this program have words in every row and column, but not necessarily the same words. These are harder to build and to solve because the search space for possible words is much larger. In fact, Word Squares are so common that most grids produced by this program will of that variety!  At right are a few non-symmetric examples.  Users can specify the number of letters to pre-fill when working on solving and I  need 7 or 8 pre-filled for the larger grids to have a chance at solving them manually.

 

March 29, 2014:  

A viewer was having trouble getting the program to work on his system, receiving "invalid data format" errors.  I could duplicate the error when "Dual Channel" input was specified when only monaural input was available.  The problem persisted because the single/dual channel option was saved and restored across multiple runs. Oscilloscope 4.2.3 posted today is a temporary fix which resets the input format to monaural when the program is started.  I'll work on a better fix next month. 
    

 


Dr; Seuss quotes to inspire you!

  •  “You have brains in your head, you have feet in your shoes. You can steer yourself any direction you choose.”

  •  “Today is your day! Your mountain is waiting so get on your way!”

  •  “You’re on your own. And you know what you know. And you’re the one who’ll decide where to go.”

  •  “Oh, the things you can find if you don’t stay behind!”

  •  “Today was good. Today was fun. Tomorrow is another one.”


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

304,000 site visits and 324,000 program downloads in the past 12 months!

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2017, Gary Darby    All rights reserved.