0
Storing high scores
I am making a small game for my programming class and would like to have a leaderboard system recording how fast a user can complete the game. Is there a way to record multiple scores and store them so it saves each time the program is run?
2 ответов
+ 3
You can store scores in a file then load them using open(file,method)
+ 3
You can use a simple list to keep the scores. They have a sort method, so you can sort them from biggest to lowest easily and keep only the first ten elements (or how long you want your best times list to be).
Using the module pickle, you can save and load that list easily and conveniently.