Delphi For Fun Newsletter #52
March 28, 2009
Unless you were born in the U.S. before 1940, you probably have won't remember of the Burma Shave roadside signs which presented "ads" on 5 small roadside signs spaced 100 yards apart. I think of those signs every year about this time because I recall one of the rhyming versions:
"Spring has sprung,
The grass has riz,
Where last year's
Careless driver is
This Wikipedia article has an interesting history of the company and many more examples (but not this one). It also says that there were 6 signs in a set, so the words "Careless" and "driver is" in my example probably appeared on separate signs. We are seeing all the signs of spring; daffodils and crocus springing to life, the Gobbler parading his harem across the yard most days, checking to see if anything is up in the garden yet, and we're working on the last of the 5 rows of winter firewood.
I've written a fair number of interesting projects this quarter including an animated 4-bar linkage demonstration that had been on the drawing board for several years. Some other geometry stuff was published including Monge's theorem about circle external tangents, a program to locate an item in space if we know its distance and direction from 4 sensors and a shadow position simulator. I also wrote an RSA Public Key Exchange demo to explain and see if it could really work (it does!), plus a few other light weight items.
Here is a summary of and links to all of the programs posted since our December newsletter.
December 12, 2008: One of the first programs posted when I started DFF 8 years ago solved the problem of finding the path from left to right through an array of random numbers with the smallest (or largest ) sum. The original version used recursion, examining every possible path to find the smallest and largest. A sharp viewer recently pointed out that a much faster algorithm existed. Sure enough, Graph Traverse Version 2 posted today adds the new algorithm and solves problems in milliseconds instead of seconds.
One last update before we take off to help Santa Claus with his deliveries. I ran across Monge's Circle Theorem the other day and decided to check out its surprising conclusion about pairs of tangents of 3 circles. Using the trusty "divide and conquer" problem solving technique, today's posting is Version 4 of our Geometry demo program which tests some new line and circle functions leading to the one to find the Circle-Circle exterior tangents needed for Monge. The demo includes brief descriptions of the algorithms used to construct the tangents.
December 27, 2008: We are home from spending Christmas with our daughter and a few of the grandchildren. Besides being humiliated by a 4 year old in a "Pacman" competition, I have a grand assortment of new reading material which should last for the next several months.
I finished up and posted
Monge's Circle Theorem demo program this morning illustrating that,
given 3 circles, the three pairs of external circle to circle tangents
do indeed intersect on the same straight line!
January 5, 2009: Holidays are over for now, time to get back on the diet and to get back to work, physical and mental. For the mental part, today's Four-Bar Linkage program is the first version of a mechanical linkage simulation that seems worthy of posting. A search of DFF for "linkages" produced only one hit before today. In an August 2002 Newsletter I wrote "I've been working on a mechanical linkages simulator program this week, but it's going to take at least another week to get anything even close to working." Guess I underestimated the complexity of that task!. It has taken 60+ hours to get today's posting which only scratches the surface of the "mechanical linkage simulation" topic. I'll be working on simpler projects for awhile to let my brain recover from the strain.
January 13, 2009: Think you could mentally flip a coin 100 times and fool a statistics professor into believing that you had recorded actual flip results? Probably not. But if you feel the need to try, play with this Coin Flip Run Lengths program first!
January 19, 2009: GPS receivers have chips that perform some pretty sophisticated math to convert satellite messages into the current receiver coordinates. Today's Point from 4 Sensors program scratches the surface of the problem.
January 25, 2009: One more
math posting for this month, a
demo of the multivariate Newton-Raphson method for solving systems
of non-linear equations. It only implements quadratic equations with
up to 4 variables, but if you want to calculate the square root of 99 to
12 decimal places, or, as in the example at right, find the
intersection points of a couple of conic sections, or find the
intersection points for three spheres, this may be just the ticket.
February 3, 2009: I am supposed to be boning up on Delphi for Net concepts, but so far I'm finding lots of frustrations. I just want to read and search a stupid flat file with a server side program to solve the Booksearch problem, but I have to learn SQL to do that? Ugh! I'm finding that too much ADO about not much is a pain in the ASP!
So I decided to write a program from Saturday's Mensa Puzzle-A-Day calendar. Chess Logic Puzzle was a satisfying diversion for a few days. Given a 4x4 board with 6 of the 12 uniquely identifiable chess pieces fixed in place, add the other 6 while meeting a few constraints. Actually not that difficult, but a good programming exercise to automate and animate the solution.
February 10, 2009: One of the last two updates seems to have broken some of the features of our List Large Files utility program which scans a specified drive and displays information about the largest files found.. The file name data was extracted incorrectly when clicking open its folder, and when formatting to create the CSV (Comma Separated Values) file. In any event, Version 3.1 posted today seems to have fixed those problems, hopefully without introducing any new ones.
February 12, 2009: Brute Force uses exhaustive search to solve a large variety of puzzles involving integer arithmetic. I started out merely to add the problem from today's Mensa Page-A-Day Puzzle Calendar, which asks you to use the digits 1-9 to complete this form when the equations are evaluated left to right and top to bottom. However, I decided to add support to the program for JPEG files in problem displays when the BMP image file turned out to be 150 Kbytes. The high quality JPEG image displayed here (and in the program) is 24 Kbytes , a significant savings. Brute Force Version 2.2 includes this puzzle and a dozen or so other sample puzzles.
February 13, 2009: Here's a little program to find a schedule of dates meeting specific month-of-year, day-of-month, or day-of-week conditions within a given range of years, especially today, Friday the 13th !
February 22, 2009: Some
programs, even after they fade away, keep resurfacing. Knight's Tour,
a program that investigates a chess Knight visiting every square on a
chessboard exactly once, is one of those.
Knight's Tour Version 4, adds the ability to define non-square
boards for the tours. The algorithm used by the program to solve these
boards does not seem to work as well as on square boards though; the 4X7
board image at right was solved only after 110,000 moves were tried. On
a 10x4 board, no solution was found after a million trial moves. You're
welcome to download the program and try your hand at solving it manually
March 1, 2009: A viewer wanted to see where his shadow would be if he knew where the sun was. Assuming that he meant mathematically rather than have me visit and point to it, I wrote this Sun Shadow Simulator program to produce a "3D" display of a vertical rod from given sun and eye positions. The program can also plot a set of shadow points created when a button is clicked or loaded from a file of sun positions. This could plot, for example, a shadow's path from sunrise to sunset on a day or an analemma, the figure 8 figure formed by plotting the shadow at the same time of day for a year.
March 12, 2009: This week's program was delayed a few days by birthday celebrations (70 for me and 5 for the other end of the family spectrum, grandson Nathan). I think his two best presents were "Wally", (the trash collecting robot) from his folks, and my gift of total control of the TV remote for the day. In case you do not know this, there are too many hours of Sponge Bob Square Pants on TV every day! I received enough books to last me through Christmas, and the "36 Cube" puzzle billed as the "world's most challenging". I'll let you know after I get the program simulation of the puzzle written.
RSA Public Key Exchange demo program was posted today, after a buddy ask me for the details of who does what to who when Alice and Bob exchange secure messages. I had thought I understood it when I read Sarah Flannery's book "In Code" last year, but I had to go back for a refresher. Perhaps this programming exercise will help it stick this time.
March 19, 2009: The
Perfect Bookmark. My third best invention ever! (Even though my
wife almost fell out of her chair from laughing so hard when I tried to
explain how brilliant the idea was.) Check it out for yourself.
Too lazy to look up new quotes this time: Here are two of my favorites about effort and attitude quoted from memory:
"I have failed many times in my career, that is why I succeeded:" Michael Jordan (Basketball player)
"Whether you think you can or think you can't, you're probably right": Henry Ford (Auto magnate)
To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm
275,000 home page visitors since Sept 2000. 360,000 program downloads in the past 12 months!
Copyright © 2000-2017, Gary Darby All rights reserved.