Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Double Hog Help
#1
Im making a game of double hog, using tkinter too, and was wondering how to make a list of high scores, or something close to as it is a requirement for it, I have the basic code done of switching turns and adding scores etc. But don't really know how to add in a scoreboard, or what about, as it is essentially who adds up to 100 first xD Any ideas?
Reply
#2
What have you done as a first effort?
Reply
#3
(Jan-02-2017, 10:34 PM)Larz60+ Wrote: What have you done as a first effort?
Should I show my code?
Reply
#4
Quote:wondering how to make a list of high scores

You would need to put this into a file that is read in at the beginning of the game,
and then updated (if necessary) at the end. JSON is probably a good bet.

Explain what needs to be in the list?
Do you need encryption?
Things like that are necessary to know.
Reply
#5
(Jan-03-2017, 12:22 AM)Larz60+ Wrote:
Quote: wondering how to make a list of high scores
You would need to put this into a file that is read in at the beginning of the game, and then updated (if necessary) at the end. JSON is probably a good bet. Explain what needs to be in the list? Do you need encryption? Thinks like that are necessary to knoe.
Well its just a basic game, nothing special, and I'm only in my second year of python at school, so I aint too good at it .-. I barely know terminology as my teacher never really got round to teaching us properly, so I'm trying to slowly learn by myself xD
Reply
#6
A good way to do a top ten list would be a list of tuples, the first item the score and the second item the person who got it:

top_ten = [(99000, 'asapb360'), (101010, 'Larz60+'), (108000, 'Ichabod'), ...]
Then when you get a new value, add it to the list, sort the list, and drop the first value. The remaining values are the top ten scores.

This could easily be stored and read using a csv file.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#7
(Jan-02-2017, 11:03 PM)asapb360 Wrote: Should I show my code?

It might help to read and understand the "rules" section at the top of the homework forum Wink
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020