Delphi For Fun Newsletter #28

[Home]

 


 
 
 
 
Friday August 16, 2002
 
It's mid-August and mid-drought here in the mountains of southwest Virginia.  In the garden, the beans have come and gone, tomatoes and corn are coming on, and we're swamped with cucumbers as usual.  A neighbor has had problems with the local bear in his beehives - we've seen him (the bear) crossing our yard a time or two, but no damage yet - a real mean shout sends him scampering off.  Cubs born 18 months ago now weigh 100 lbs. or so and are on their own for the first time.   Some of them need a little educating about what is acceptable behavior.  Summer grandkid visits are over and things are getting back to normal.   
 
 I've been spending an early hour or so each day working in the garden or on our winter wood supply.   The afternoon summer heat provides a good excuse to stay inside and play on the computer.    I managed to crank out nine new fun programs since last time - give them a try!      
 
 

  

Here are the "What's New"  items:

 

 

June 27, 2002:  More brain candy for the younger set.   The SafeCracker program represents an unusual  safe.  Each of the buttons must be pressed in the correct order to open it.    The distance to move and the direction are indicated on each button.  The last button is marked  "LAST".  The safecracker's job is to locate the first button and unlock the safe by clicking  the chain of buttons from first to last.   (By the way, even though the image at left looks computer playable, it's not, so save your clicking finger.  You can copy it to paper and try it though.   You can also follow the link above to download the executable or Delphi source code for SafeCracker in order to generate and solve many puzzles of many sizes.)

 

June 20, 2002:  One of the proposed changes for the Traveling Salesman Program was implemented today.  It was just too good to resist,  reducing exhaustive search times for the 13 city closed route by 94% and increasing the maximum practical search size by a city or two.    See the Further Explorations section at the bottom of the Traveling Salesman Program page for more details. 

 

 

July 13, 2002:  A Magic Cube is a logical extension of a magic square into the third dimension.  Here's a Magic Cube  program that doesn't haven't have much user interaction, but it does search, (and find),  all 192 semi-perfect magic cubes of order 3.   They are not quite perfect because the diagonals on each face cannot be made to  sum to the required magic constant, 42.   But the 31 rows, columns, pillars, and space diagonals (corner to opposite corner through the center number)  all can.   By the way, the smallest cube that can be perfect  is 8x8x8.   Beware!  For a small percentage of the population, playing with magic squares, cubes, and hyper-cubes  may be addictive!  

 

 

July 15, 2002:  Here's a small puzzle that I've named Solitaire for Squares.   No chance involved here, just a little thought and perseverance.   Remove the Spades and Hearts from a deck on cards.  Layout the 13 Spades in order Ace through King.  Place a Heart on each Spade so that the sum of each Spade-Heart pair is a perfect square (4, 9,16, or 25).   Just to prove that it knows how, the program will provide hints if you really get stuck.  

 

 

July 22, 2002:  Some kids wanted to set up a lemonade stand to make money. To set themselves apart from the other lemonade stands on the block, they decided to sell their lemonade by the pound. They found an old balance beam scale, the kind with a weight pan on each side, and three weights. They discovered that they could sell any whole number of pounds from 1 to 13. What weights did they have.?  Weights #1 searches for the answer to this question for any number of weights from 1 to 5.  There's also a scale where you can practice with things of unknown weight,  I guess they could be lemonade containers.

 

July 23, 2002:  Today,  I added a long needed Google "site search"  feature to the left border of each page over in  the Programs section.   With more than  100 programs now (Google has indexed  300 pages),  I'm having trouble locating things, and I put them there!  Send me feedback if you have any problems.  

 

July 28, 2002:   I've spent most of this past week adding an explanation facility to my "Logic Puzzle Solver" program.  It solves most of those logic puzzles found in  Logic Puzzle magazines  from Dell Publications.  It will take another week or so of polishing, and we have the back-east  grandkids visiting next week, so I decided to post this beginner's level T-Shirt program to fill the gap.  T-Shirt #5 helps us find the smallest 3 (or 4, 5, 6, 7, 8 or 9)-digit emirp  for the front of our shirt. 

 

 

August 7, 2002: Well, it took 18 years, but here at last is the Logic Problem Solver program.   Actually, I haven't been working on it for that long but I last compiled the original Turbo Pascal version in 1994.   I converted it to Delphi and Windows and added the user interface a couple of years ago. This past month I finally worked up the courage to delve back in and make the 5000+ lines of code suitable for posting.   

The program solves those: "Jeff has red hair.  Kaitlin is 11.   Who won the World Series?"  type of logic word problems.    There are three ways to play with the program: as a "Solver" you need to extract enough facts and rules from the included sample problems so that the program can figure out the solution.   As an "Author" you can enter  new problem descriptions.  And finally, as a "Programmer" you can try to figure out how the heck it works (and perhaps make it work better).   

 

August 10, 2002:  Here's a program that solves "The Know-Don't Know Logic Problem", sometimes called "The Impossible Problem" or "The Sum-Product Problem".

Two integers, A and B, each between 2 and 100 inclusive, have been chosen.  The product, A×B, is given to mathematician Dr. P. The sum, A+B, is given to mathematician Dr. S. They each know the range of numbers. Their conversation is as follows:

P: "I don't  have the foggiest idea what your sum is, S."
S: "That's no news to me, P. I already knew that you didn't know. I don't know either."
P: "Aha, NOW I know what your sum must be, S!"
S: "And likewise P , I have figured out your product!!"

What are the numbers?    

It takes a little convoluted reasoning to solve it and  most explanations left me slightly puzzled.   My approach includes the best explanation you'll find  (he said immodestly :>)).

 
August 11, 2002:  While developing  the "Know-Don't Know" program I fixed a silly timing problem in the U_Primes unit which tests for primality.  The IsPrime function now runs about 100 times faster than it did last week.   I posted the fix today over in Prime Factors 1  where U_Primes originally appeared.
 

August 16, 2002: An Oscilloscope program driven by sound card inputs has been on my list for quite a while.  I finally bit the bullet and did it this week.  Here's A Simple Oscilloscope program that is just that. 

 If you use a microphone for input and click your tongue and the "Stop Display" button at the same time, you can prove for yourself that there are really two distinct sounds generated - one when your tongue leaves  the roof of your mouth and the other when it slaps the floor (of your mouth :>)).

____________________

Gary Darby
http://delphiforfun.org/

 


"To avoid criticism...Do nothing...Say nothing...Be nothing!" -- Elbert Hubbard
 
"Even the turtle never got anywhere without sticking his neck out" -- Unknown
 
"Whatever you can do, or dream you can do, begin it. Boldness has genius, power, and magic in it."  Goethe
 

 

 
To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm
 
22,424 home page visitors!