Delphi For Fun Newsletter #4

[Home]

 

 
Monday, Oct 16, 2000
 
 
 
Well, a busy week here in the Blue Ridge.  I got plenty of exercise cutting, bucking, hauling, splitting and stacking wood.  Who said firewood only warms you twice?   I did find time while watching league championship baseball to get few programs documented and posted.  Most of these turned out to be base-building programs to solve little problems so that we can use the solutions to solve more complex problems in the future.  
 
That's an excellent problem solving technique by the way, highly recommended for any tough problem - break it into smaller simpler problems and then put the little problem solutions back together to solve the big problem.   
 
Cards1 is the predecessor to a graphics version of a program that knows how to shuffle and deal a deck of cards.  This one has a TDeck object that knows how to shuffle and deal, it just doesn't know how to draw cards so it displays cards with text;  "Q-Hearts", "2-Spades", etc.
 
Towers of Hanoi 2, builds on version 1 of the Tower program by knowing which moves to make to solve the puzzle for a particular number of disks.  It just lists the moves.  Version 3 will graphically move the disks.
 
Primefactors1 is the most complex program listed this week (intermediate level).  It tests input numbers for "primeness" and lists the prime factors if they are not.  Prime numbers are positive integers that have no divisors except "1" and themselves.   It handles integers up to 1,000,000,000,000,000,000.   The GetNextPrime, and IsPrime functions developed here will be used in a number of future programs to solve puzzles and problems.  
 
A StringParser program to split strings of text into individual words was posted in the Delphi Techniques section of the site.  Splitting text into words is a common task for almost every program that manipulates text.  The sample program included here just reads a text file and displays a sorted list of words and word counts. 
 
Finally, Rotate A Square  mathematically rotates a square at any angle around a point.  I wrote it to solve the problem so I could visually elevate the cannon in the Cannonballs program that I plan to post later this week. 
 
As always, you can read about, download the source for, or download the executable for, all of the programs. 
 
Well, muzzleloader season opens in less than two weeks so it's time to start rounding up the necessary gear - that should take the rest of the week.    We had a big doe fight in the yard down below the house tonight.  I've got my eye on the winner.  See you next week.    
 
To subscribe or unsubscribe, go to the site and click on "Newsletters".
 
Gary
 
_____________________________
Gary Darby
http://www.delphiforfun.org
--------------------------------------------------

My favorite Latin quote:  Quidquid latine dictum sit, altum viditur.  
(If it's in Latin, it's obviously important )