Home  Introduction  Newsletters  Programs  Feedback


January 14,
2008
Delphi For Fun Newsletter #48
Cooler weather has finally arrived here in the Appalachians in spite of "global" or "natural cyclical" warming (take your choice). The deer are in the freezer, we've survived the first big ice storm of the year, and the seed catalogs are arriving, so this must be January. Happy New Year! My time this winter is divided between writing programs and planning for our big 50th anniversary trip to Europe next spring. We'll be spending several weeks visiting old favorites (Netherlands, Switzerland, Germany, and Ireland) and some new places (12 days of Mediterranean cruise stops from Istanbul to Barcelona, plus Normandy). It could be the best trip yet except that we will only have part of the family with us for part of the time. It's a fact of life that planning joint family vacations gets more difficult as school years get longer and grandkids grow up.
A few new programs and the usual batch of enhancements have been posted for the 4th quarter of 2007. The most interesting to me was the "Age Problem Solver" (posted November 14) which solves a specific type of story problem using the problem text as input. The syntax checking is controlled by text files and so far I have been able to get it to solve all of the problems of that type that I've run across.
Here's a summary of the postings since last time:
• October 12, 2007: Version 3 of our Crossword Generator was posted today. It enhances puzzle generation by centering the initial word and trying up to 1000 random puzzles in order fit the number of words requested. The puzzle at left (generated from sample file
Continents.txt), includes all 7 continents. It was generated on the
10th attempt using "extended search" and would likely not have been found by the
previous version October 16, 2007: A viewer recently wrote asking to clarify a problem he was having determining the coordinates where a line from the center of a rectangle, ABCD, at a given angle, q (theta), would exit the rectangle. Since I'm currently semistuck on a more complicated project, it seemed to be a good excuse to take a break and do something simpler. Ray Intersecting Rectangle is my attempt to help Joe with his problem and reboost my confidence that I can get something to work at least!
• October 17,2007: Here is a utility program, HexView, whose sole job is to display the contents of any file. Computer memory and files consist of binary data (bits) which are generally handled in 8 bit chunks called bytes. Since most of the 256 possible bytes do not have unique display characters assigned, a hexadecimal (base 16, 4 bits per hex digit) display is a relatively compact way to show all of the data in a file. Two hexadecimal digits can exactly represent any byte. • October 29, 2007: Today's problem is from yesterday's NPR "Car Talk" radio show puzzler: In a certain family, each boy child has twice as many sisters as brothers. Each girl child has the same number of sisters as brothers. How many children are there of each gender? The algebra is not too bad once you convert the words to equations, but I decided to modify BruteForce, a program which uses an exhaustive search from a set of possible integer solution values. For BruteForce Version 2.1, I added an option to let more than one variable assume the same value. Sample problem "Brothers and Sisters.prb" is included in the downloadable zip files
:
• November 8, 2007: The "KnowDon't Know" problem is a puzzle to find two integers based on a conversation between two professors (or programmers), one of whom knows the sum of the 2 numbers and the other who knows only the product. Both know that the numbers are are in the range 2 to 100. Know_Dont_Know Version 2 posted today expands the range of the numbers up to 1000. The change took an hour, but understanding and verifying the results took several days. Being a curious problem solver is a mixed blessing sometimes. • November 14, 2007: Every high school Algebra student's dream would be a program to solve "story problems". Dream no more, here it is!. OK, so it doesn't exactly solve all of the possible story problems, but it does generate algebraic equations describing at least the 8 "age" type story problems that have appeared in the current Mensa Brain Puzzlers PageADay Puzzle Calendar . You know, the kind that reads "Al is 3 years older than Bob. In 2 years, Bob will be half as old as Al. How old are they? " Check out the new Age Problem Solver program for the answer. • November 21, 2007: Last week's "Age Problem" program produces the equations to solve the problem, but does not actually produce the numeric answers. Thinking to finish it up, I went looking for an expression evaluator which would let me find the set of ages which satisfy the equations, but found that I didn't have any such thing in a very portable form. Today's program, Expression Evaluator, fills that gap. It's contains a new TEval object and a demo program showing how it works by first converting input expressions to "Postfix" notation list. This is almost a standard for compilers and other programs which must evaluate text versions of arithmetic expressions. • November 28, 2007: Age Problem Solver, Version 2 was posted today. It completes the solving process by finding the numerical ages which satisfy the equations generated from the story problems by the first version. It uses last week's Expression Evaluator class to find the solution by "trial and error", a good method for computers which tend to be fast and accurate, but not very smart. The lucky thing is that even programmers like me, who are not so fast, not so accurate, and only medium smart, can tell the computer what to do! • December 3, 2007: An updated entry for the programmers. A viewer wrote recently and pointed out that the techniques to handle international differences in decimal points should also consider thousands separator differences. US value 12,345.67 is written as 12.345,67 in most of Europe and other parts of the world. The DecimalSep2 program posted today in the Delphi_Techniques section of DFF addresses that situation. • December 11, 2007: Deer hunting and playing plumber have reduced programming time this past week, but I did find time to update the age problem solver to handle today's Mensa puzzle calendar problem. Age Problem Solver V2.1 with two additional test cases makes the program just a little bit smarter. • December 14, 2007: Version 3.1 of Bitmap Chunks was posted today. The program is an exercise to efficiently find connected "chunks" of a bitmap image. Today's update fixes a memory leak that occurred when multiple images were scanned within a single execution of the program. The lists of pixels belonging to each chunk were not completely released between images. • December 19, 2007: One more small program update before we take off for the Christmas holidays. The Binary Card Trick program posted last year has been updated to include better looking cards. The program is one of where someone thinks of a number from 0 to 15 and, as you show them a series of 4 cards, says "Yes" or "No" to indicate if their number is on that card. You lay each card in a pile as they answer, and after the 4th card, show them that their number is magically the only one displayed! January 6, 2008: Happy new year! Except for the stock market and the 5 pounds I have to lose again due to all of the holiday goodies, things are going well. I have a few program fixes, suggestions, and enhancements emailed by viewers over the holidays that I'll get to review in the coming days. The one that caught my interest enough to jump to the top of the list was this: My local bar has a game. 5 dice in a cup. You have to roll 5 Two's in two shakes and you can "farm". i.e. Roll the first time, save any two's, pick up the remaining dice and roll them. What are the odds that five two's will be rolled this way? The bet is $2 and the pot is currently over $2,800.00. Just curious. Thanks. Dice Chance of 5 Twos answers the question in a few different ways. I didn't put it in the Math Topics section of DFF, but probably should have. I told Cliff that I would split the winnings with him when he hits! January 11, 2008: A new version of the game of Go (Version 3) was posted today. It corrects an error in diagnosing "Ko", a situation in which a board position is would be repeated if player B were to to replace a stone removed by player A. Go is a 3000 yearold simple but complex game with its origins in the orient and still most popular there.
Gary Darby
"You
can't build a reputation on what you're going to do."  Henry Ford
To subscribe or unsubscribe from this newsletter, visit http://delphiforfun.org/newsletter.htm
222,900 home page visitors since Sept 2000. 401,000 program downloads in the past 12 months! 
[Feedback] [Newsletters (subscribe/view)] [About me]Copyright © 20002017, Gary Darby All rights reserved.
