sriyash421 / Arcus

A simple game made in Python using pygame
6 stars 13 forks source link

PEP 8 compliant and barebones for leaderboard #25

Closed rupansh closed 4 years ago

rupansh commented 4 years ago

Unfortunately I don't have enough experience with pygame to implement a leaderboard. display_name can be used as reference as well! a tip for the person who might implement leaderboard: Sort name:highscore pair by highscore:

from collections import OrderedDict

highscores = {arr[0]: arr[1] for arr in file.readline().split("\n")) # assume you have with open(...) setup
highscores = OrderedDict(sorted(highscores.items(), key=lambda x: x[1]))
rupansh commented 4 years ago

@sriyash421 please respond/merge it. kwoc is ending soon!

sriyash421 commented 4 years ago

The changes to high score function is causing out of index error. If possible please send only a commit with pep8 compliance

rupansh commented 4 years ago

The changes to high score function is causing out of index error. If possible please send only a commit with pep8 compliance

Do you have an empty highscores.txt or a highscores.txt without the new name:score format?

sriyash421 commented 4 years ago

The changes to high score function is causing out of index error. If possible please send only a commit with pep8 compliance

Do you have an empty highscores.txt or a highscores.txt without the new name:score format?

Maybe, I have an empty file and it should work in that

rupansh commented 4 years ago

The changes to high score function is causing out of index error. If possible please send only a commit with pep8 compliance

Do you have an empty highscores.txt or a highscores.txt without the new name:score format?

Maybe, I have an empty file and it should work in that

An empty highscore.txt is never written by the game, and thus it is unexpected to have an empty one. If you still wish to have unnecessary exception handling by the function, I don't mind it. will push the code

rupansh commented 4 years ago

@sriyash421 Done! please merge the PR