kind of works, show winner(but not if equals)

This commit is contained in:
yann 2025-01-31 10:42:24 +01:00
parent c30d907847
commit 6e476e8301
3 changed files with 11 additions and 5 deletions

View File

@ -8,7 +8,7 @@ class Participants(UserDict):
takes tournament's name and list of object Player
returns dict with player: score"""
def __init__(self, player_list): #player_list FOR TEST ; to feed when creating object
def __init__(self, player_list=None): #player_list FOR TEST ; to feed when creating object
#self.tournament
self.player_list = player_list
self.data = {}

View File

@ -1 +1 @@
{"EF34924": ["Bob", "Durand", "25/12/1995", "M"], "QS42622": ["Joe", "Bidjoba", "02/01/2001", "M"], "AB20022": ["Jeanine", "Mequesurton", "25/12/1995", "F"], "JF78739": ["Jean-Pierre", "Quiroul", "15/09/1992", "M"], "ED22230": ["Ren\u00e9", "Nuphard", "25/12/1995", "M"], "EE49948": ["Sophie", "Fonfec", "24/05/1999", "F"]}
{"EF34924": ["Bob", "Durand", "25/12/1995", "M"], "QS42622": ["Joe", "Bidjoba", "02/01/2001", "M"], "AB20022": ["Jeanine", "Mequesurton", "25/12/1995", "F"], "JF78739": ["Jean-Pierre", "Quiroul", "15/09/1992", "M"], "ED22230": ["Ren\u00e9", "Nuphard", "25/12/1995", "M"], "EE49948": ["Sophie", "Fonfec", "24/05/1999", "F"], "JG43857": ["Gérard", "Pala", "15/03/2011", "M"], "UD47293": ["Géraldine", "Palelundi", "12/05/1999", "F"]}

12
vrac.py
View File

@ -138,20 +138,26 @@ def test3():
tour.input_scores()
print("Save \n", tour.name, tour.match_result)
tournoi1.turn_list.append([tour.name, tour.match_result])
print(tour.name)
def display_winner(participants):
base =
for i in participants:
if participants[i]
pass
# liste = tour.sort_player_by_score
# for i in participants:
# if participants[i]
print("Début du", tournoi1.name, "!")
while turn_nb < tournoi1.total_turn:
tournoi1.current_turn = turn_nb
run_turn(turn_nb)
turn_nb += 1
#scores = sorted(participants.items(), key=lambda t: t[1])
winner = max(participants, key = participants.get)
print("participants.get", participants.get)
print("\nLe", tournoi1.name, "est terminé.\n")
print("Scores finaux:\n", participants.data)
print("Le vainqueur est :\n", winner)
print("liste des tours:\n", tournoi1.turn_list)
#for i in range(1, tournoi1.total_turn+1):