Delphi For Fun Newsletter #22




Monday October 29, 2001
Delphi For Fun Newsletter #22
It's been a couple of months since the last update - quite a bit has happened  but a Roller Coaster Simulation is the biggie, program-wise.   I started it about 6 weeks ago and decided I'd finish it before posting the next newsletter.   RCoaster4 was posted yesterday,  just a month later than anticipated.   In the meantime, the garden is gone, the deer have traded their red summer coats for the winter gray-brown version,  my wood supply is cut, if not all split,  temperatures dipped to 21 degrees last night, and the ghosties and goblins will be out in a couple of days.   
Disk space usage is at or near its limit on my current host site.  Plus we're still having problems with the program index that appears in the left hand column of program description pages.  It seems to be size related, adding any program to the index causes the index to disappear.     I'm looking into relocating to a Windows based server to address these problems and so that we can explore some Delphi web-based programs.   If it happens, and goes smoothly, I'll just post a note on the home page.  If it happens and interruptions occur, I'll send a note when things get back to normal.    
Here are the "What's New"  items since last time.   Enjoy. 
August 30, 2001:  I'm back!  Two more weeks of entertaining grandkids was time well spent.   But they're all back in school now, so I guess it's time for me to get back to work too.    I just saw that Borland is offering a free download of Delphi 6 Personal!, in exchange for answering some survey questions - sounds like a fair exchange to me.   Not surprisingly, the actual download link seems to be overloaded right now - but sometime in the next week or two you should be able to get a copy.   Be warned, it looks like it's a 140mb download.
 August 31, 2001:  A Delphi Topics page was posted a while back showing how to sort a StringGrid on any column.   The simple sort used there was fine for a demo with a few rows - not so good when I tried it on a 10,000 row grid recently.  Here's a page with a StringGrid version that will do the job in a few seconds instead of minutes or hours.  The application, by the way, is a booklist browser for the Accelerated Reader program used in a number of schools these days (including  the school of one of my three  precocious [and precious] granddaughters).   A Web-based version is next -  I'll keep you posted.    September 28: 2001:   I'm still alive - working a few hours per day on the Roller Coaster Simulator project.  I think it's going to be  a good one.  I keep spending time playing with it when  I should be working on it.    One of the final problems was calculating centripetal forces for hills, dips and loops.   The force for a body turning is inversely proportional to the radius being turned  (e.g. cut the radius in half - double the force).    The problem of determining the radius lead to this Math Topics page   "Define a circle given 3 points"  which tests  the functions used in the Coaster project.    


September 2, 2001:  Here's another Martin Gardner invention - the Game of Hip, first published way back when everyone knew what the word "hipster" meant -  as in "hipsters" avoid "squares".  

 It's a two-player game with the objective not to complete 4 corners of any square with your tokens.  This version supports both human and computer opponents.  There's trick that makes it easy to win (or at least not lose, a tie is possible). But it is a fun mental geometrical exercise anyway.  


September 5: 2001:  Happy 1st Anniversary!  

Almost missed it but  Delphi For Fun went online one year ago yesterday.    7000 home page visitors and 34,000 sessions, whatever those are,  later, we're still going strong with a bigger backlog  than ever.    For what it's worth, here are the stats from the first year of operation.  Now if only  my net worth chart  looked this good ...


OK, back to trying to figure out why my new Delphi web program works fine locally but gives me an "Internal Server Error" when I try it here.   (Update - Oops -  since DFF is hosted on a Unix system, we're out of luck re running Delphi apps remotely, unless I find a Windows hosting service or get Kylix).    

September 6:2001:  Borland has changed the link for downloading free D6 Personal.  I just corrected the link in the August 30 posting.  I managed to download 15 of the 140 mb, then cancelled to see if it would recover gracefully.  Before I got back to it the link stopped working.   They've changed the logon procedure and the download site still seems to be overloaded.  Hope it means we're getting thousands of new Delphi users!     


September 7:2001:  The customized cursors page that I promised a couple of weeks ago has been posted in Delphi Techniques.   Not a biggie, but if you're doing customized cursors, or want to include pictures, multimedia files, or other data  as part of your executable module, this page will give you a starting point.   


September 16:  Still sorting out emotions from Tuesday's tragedy.  Mainly anger and frustration at those who would make us less free.  Have they thought this all the way through?  I think not.   

I spent a few  days this week working on a QuickSort demo program that would explain itself as it sorted.  As a result I understand the QuickSort algorithm pretty well, but not because of any program output.  Too much text is as bad as none.   Maybe an animated sort would be more instructive.  Anyway, back to the drawing board on that project. 

Here's a Simple Gravity Cart program written as a test-bed for a planned roller coaster simulation.    This cart knows how to accelerate downhill and decelerate uphill and slow down both ways due to friction.   It took a long time to teach it to stay on the track, now I have to teach it to fall off the track if gravity dictates.  Still, enough physics and animation techniques here to make it interesting.



October 1, 2001:  Many of you puzzlers will recall  that it takes 23 randomly chosen people to have a better than 50-50 chance that at least two share the same birthday.   But what if those odds aren't good enough?  How large a group will we need to be 90% sure that duplicate birthdays occur?    The solution requires only about 5 lines of Delphi code. (well OK, 50 lines, but Delphi generates the most of them.)  

 To get the code (and the answer to the question), check  this  Shared Birthdays Math Topics page.


October 15, 2001: A recent Business Week article discussed the current youth fad of clothing with numbers.   That gave me the idea for a line of T-shirts with "interesting" numbers on the front and the reason that they are interesting printed on the back.   Here's a sample shirt back:  "The 3 digit number with the most divisors".    What number appears on the front?  Most Divisors is a beginners level program that provides the answer.   



October 9, 2001:  Page formats should be OK again.  Some of you may have thought it was just lousy  design that eliminated the index to other pages within the Programs, Delphi-Techniques and Math-Topics sections of our site.  It was good design , just lousy implementation of a bright idea I had last week - but I now  understand "Shared borders" and "Navigation bars".   (I hope).        

Here's a program that solves the "9321 problem".  Insert  operators between the digits to form expressions that evaluate to 0,1,2,...,9.   Operators are +, -, *, and /.    So, for example,  9-3*2+1=4.  Our program generates  valid solutions by trying all 64 permutations of operators.  

October 20, 2001: What is the lowest number that can be divided by 6 with a remainder of  5; by 5 with remainder  4; and by 4 with remainder  3?  (Mensa Puzzle Calendar, October 18, 2001).  Or the original Chinese version: 

We have a number of things, but we do not know exactly how many. If we count them by threes we have two left over. If we count them by fives we have three left over. If we count them by sevens we have two left over. How many things are there?."

The Chinese scholar, Sun Zi, provides a rather obscure poem about septuagenarians and plum trees as a solution (at best a hint, it seems to me).    With or without poems as hints, Chinese Remainder problems seem quite difficult to solve without a computer.  With Delphi we can solve them with this Beginner's level Chinese Remainder  program of about 50 lines of code.  A second longer version is included which does better error checking and allows larger problems to be solved

 We are still fighting problems with left  shared borders in the Programs section.  The Programs section home page has a complete index of program entries.  The index on other program pages is missing at least the current Chinese Remainders entry.   


October 28, 2001: At last the Roller Coaster Simulation program has been posted.  Back in mid-September when I posted the Simple Rolling Cart predecessor, I thought that a couple of weeks would be plenty to finish the coaster.    Wrong!  But it does work pretty well and allows users to design and save tracks with hills and loops and even warns you when your riders may not survive the ride.




"Curiosity is one of the most permanent and certain characteristics of a vigorous intellect."  Samuel Johnson

"Curiosity killed the cat - satisfaction brought it back."  Anonymous
"Somewhere, something incredible is waiting to be known."  Carl Edward Sagan
To subscribe or unsubscribe from this newsletter, visit
8460 visitors!