This discussion is archived
4 Replies Latest reply: Aug 19, 2010 11:10 AM by 843853 RSS

Rank in a java game

843853 Newbie
Currently Being Moderated
Hi ppl,
I'm newbie in this forum, I'm development a java game and now I would like to implements a rank for players.
Basically, I have some players that play to the game and then (at game finish) game will write a .txt file with date, score and name player.
How I can implements it?
Thanks, regards.
Michael.
  • 1. Re: Rank in a java game
    796262 Newbie
    Currently Being Moderated
    MichaelStu wrote:
    Hi ppl,
    I'm newbie in this forum, I'm development a java game and now I would like to implements a rank for players.
    Basically, I have some players that play to the game and then (at game finish) game will write a .txt file with date, score and name player.
    How I can implements it?
    Thanks, regards.
    Michael.
    Is google broken?
    [Lesson: Basic I/O|http://download.oracle.com/javase/tutorial/essential/io/]
  • 2. Re: Rank in a java game
    843853 Newbie
    Currently Being Moderated
    link is broken...then need help in how implements...such as write in a txt file and then apply a bubble sort algorithm?
  • 3. Re: Rank in a java game
    796262 Newbie
    Currently Being Moderated
    MichaelStu wrote:
    link is broken...
    The link works for me, but if for some reason it doesn't work for you, just google "java file IO". Read through the tutorial carefully. Ask a question when you get stuck, and make sure you post an [SSCCE |http://sscce.org] demonstrating the problem.
    then need help in how implements...such as write in a txt file and then apply a bubble sort algorithm?
    What? You are thinking about it all wrong. Why would you write to a file and then sort?

    One thing at a time. Split your problem up into smaller pieces. Sorting your data is a completely different issue than writing to a file, and for that I'd recommend googling comparators and looking up the sort functions of the Collections and Arrays classes in the API (since links don't work for you, go ahead and google those too).
  • 4. Re: Rank in a java game
    843853 Newbie
    Currently Being Moderated
    Collection has a sort, so any object you use that implements Collection can be sorted very easily, then just write the sorted collection out to your drive as a text file or what ever you want.