Skip to content

Complete player ranking system: registers names and scores, updates automatically, sorts from highest to lowest using lambda, saves and loads data in JSON, prevents duplicates, and allows displaying the top N players.

License

Notifications You must be signed in to change notification settings

Spinnyz/Player-Ranking-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Player Ranking System

A player ranking management system developed in Python, allowing you to add players, update scores, list rankings, search for players, and save/load data persistently through an interactive terminal menu.


Features

  • Add players: Register new players with name and score.
  • Remove players: Delete a player from the ranking.
  • Update scores: Add points to an existing player's score.
  • List ranking: Display all players sorted by score (highest to lowest).
  • Top players: Show players with scores above a certain threshold (40 points).
  • Search players: Find a player by name.
  • Persistent storage: Save and load players automatically using JSON files.
  • Interactive interface: Terminal menu for easy use.

How to Use

  1. Clone the repository:
    git clone https://github.com/your-username/python-player-ranking.git
  2. Navigate to the project folder:
    cd python-player-ranking
  3. Run the program:
    python main.py
  4. Use the interactive menu to manage players:
    [1] Add player
    [2] Remove player
    [3] Update score
    [4] List ranking
    [5] Top players
    [6] Search player
    [0] Exit
            

    Data is saved automatically when you exit (0).

    Players are stored in ranking.json for persistent storage.


Example

ranking = Ranking()
ranking.adicionar_jogador("Alice", 50)
ranking.adicionar_jogador("Bob", 30)
ranking.atualizar_pontuacao("Bob", 15)
ranking.listar_ranking()
print(ranking.top_jogadores())

Output:

Alice: 50 pontos
Bob: 45 pontos
['Alice', 'Bob']

About

Complete player ranking system: registers names and scores, updates automatically, sorts from highest to lowest using lambda, saves and loads data in JSON, prevents duplicates, and allows displaying the top N players.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages