When a new score is achieved, the first task will be to find out if it should be entered into the high score file. It should only be entered if there are less than 10 records OR
the score is bigger
than the SMALLEST
score already recorded.
Therefore I need to be able to check how many records are in the file and if there are less than 10 I can just add this record to the end. If there are 10 records then I need to be able to search the file for the smallest score in the file and replace it.
If I find a record that needs to be replaced then I need to replace the complete line – the name and score. Small Basic supports the feature File.WriteLine( File, LineNumber, Data ) which replaces a line at a specific point (indicated by LineNumber), in the file.