High Scores

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]




Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.


Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 


We receive a few cents from each purchase.  Thanks


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)


Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only





Here is a TScores class that will keep track of name and score of the top scorers for your games. 

It works like this:

TScores is derived from TObjectList and maintains the specified number of high scorers in a list as TScoreObj objects.  Each TScoreObj contains a name and score.  The list is maintained in descending score sequence.  TScores has the following methods:

bulletProcedure LoadScores(scoreFilename:string);  Initializes a TScores instance with previously saved top score information.    If  "scoreFilename"  file does not exist, an empty file is created. The file is  saved is an "Init" file format using TIniFile.   Note that by default TIniFile will look for and create files in the  Windows folder unless the filename includes path information.   In this test program, I create and maintain the file in the same foplder as the executable program. 
bulletProcedure SaveScores(ScoreFileName:string);   Saves the current scores in the specified file.  
bulletFunction SetScore(newscore:integer; newname:string):integer;  Creates a TScoreObj object and inserts it in the appropriate place in the list (based on descending score information).  If the number of entries in the list after this insertion exceed the desired number of entries to keep, the final entry in the list is deleted. 
bulletProcedure GetScores(list:TStrings);  Returns a displayable version of the information in TScores.
bulletFunction AddRec(rec:TScoreObj):integer;  Function used by Loadscores and SetScore to add objects to the list.  Probably not required for normal user use. 

The test program simply lets you add scores to a displayed list, clear the list, and change the number of of top scorers to remember.

I haven't really used the  code much so, as usual, let me know if you find a bug. 

Download source


Created: January 14, 2004

Modified: May 12, 2018



  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2018, Gary Darby    All rights reserved.