Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Making a dynamic high scores table

by roboticus (Chancellor)
on Dec 01, 2012 at 17:20 UTC ( #1006617=note: print w/replies, xml ) Need Help??


in reply to Making a dynamic high scores table

chickenlips:

I'd suggest storing the high score list in a file so that when you restart the game, you still have the original values. So your subroutine to save & display high scores might be something like:

  1. Read high-score-list file
  2. Add new score, initials
  3. Sort list
  4. Display
  5. Write back new high-score-list to file

Optionally, if you want to keep only the top X scores, then after sorting, just write the first X items back to the new file. Also, to prevent a program problem from causing you to lose the entire list, write the new list to a different file. Once you're done, then you can rename the original to original.bak, and then rename the new file to the original name.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006617]
help
Chatterbox?
[usemodperl]: just answer my question without judging me or my technique, if that's possible around here anymore, sheesh
[Corion]: usemodperl: You should be well aware of the ways to make your approach still work, even if it is to set up your own proxy that strips HTTPS. It shouldn't be hard for somebody with your acumen.
[Corion]: Unless you just want to vent your frustration about how others don't provide for your whims. That's sometimes necessary. There, there.
[usemodperl]: so to answer my question, no http at cpan, and all rationalized too, thanks
[marto]: this 'safe space' thing you have going on seems just like wanting to whine without anyone replying
[Corion]: usemodperl: Naah, if you scroll back, you'll find several approaches that still work. Maybe a prewrapped solution like CPAN::Mini is what you want. Or maybe App::FatPacker. But you don't seem to want to listen. That's OK.
[Corion]: There, there. It'll all be better.
[marto]: usemodperl "so to answer my question, no http at cpan," doesn't tie up with what you said "I can find cpan mirrors on http"
[usemodperl]: yea but http only has tar.gz, i wanna download modules with core perl, but http seems to make it impossible, that's my only question, how to find http mirrors like meta, or how to do it with core perl, but options now seem totally broken (on purpose :-(
marto wanders off

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2018-06-24 16:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?