Star Student Builder logoStar Student BuilderA Learnerโ€™s Guide
โ† Systems, Data and the Way Out Std 9โ€“12Project 2 of 4

A High Score Table That Survives

๐ŸŽฏ The top five scores, with names, kept in order and saved with the project.

๐Ÿ’ก The idea behind it

Inserting into a sorted list is a real algorithm, and it is the same one in every language.

๐Ÿงฑ Blocks you will need

listsinsert at of listdelete of listrepeat untiljoinitem of list

๐Ÿ”จ Build it

  1. Two lists: scoreNames and scoreValues, kept in the same order.
  2. At game over, ask for a name.
  3. Walk down the list: set i to 1, repeat until (i > length) or (score > item i of scoreValues) โ†’ change i by 1.
  4. Insert the new score at position i in both lists.
  5. If the list is now longer than 5, delete item 6 from both. Display with a join of rank, name and value.

๐Ÿš€ Make it harder

  • Handle a tie by putting the newer score second.
  • Show the table sorted on the stage using a single text sprite and a join loop.

๐Ÿž Bugs you will hit

  • Names and scores drift apart: every insert and delete must be done on BOTH lists, always in the same step.
  • The new score never appears: your comparison is the wrong way round โ€” check > against <.

โฌ‡ Need Scratch itself?

Free from MIT, in a browser or as an offline app that needs no connection at all.

Get it โ†’
Ask GuruAcharya Samayeshwar