kind of works, show winner(but not if equals)
This commit is contained in:
parent
c30d907847
commit
6e476e8301
@ -8,7 +8,7 @@ class Participants(UserDict):
|
|||||||
|
|
||||||
takes tournament's name and list of object Player
|
takes tournament's name and list of object Player
|
||||||
returns dict with player: score"""
|
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.tournament
|
||||||
self.player_list = player_list
|
self.player_list = player_list
|
||||||
self.data = {}
|
self.data = {}
|
||||||
|
@ -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
12
vrac.py
@ -138,20 +138,26 @@ def test3():
|
|||||||
tour.input_scores()
|
tour.input_scores()
|
||||||
print("Save \n", tour.name, tour.match_result)
|
print("Save \n", tour.name, tour.match_result)
|
||||||
tournoi1.turn_list.append([tour.name, tour.match_result])
|
tournoi1.turn_list.append([tour.name, tour.match_result])
|
||||||
|
print(tour.name)
|
||||||
|
|
||||||
def display_winner(participants):
|
def display_winner(participants):
|
||||||
base =
|
pass
|
||||||
for i in participants:
|
# liste = tour.sort_player_by_score
|
||||||
if participants[i]
|
# for i in participants:
|
||||||
|
# if participants[i]
|
||||||
|
|
||||||
print("Début du", tournoi1.name, "!")
|
print("Début du", tournoi1.name, "!")
|
||||||
while turn_nb < tournoi1.total_turn:
|
while turn_nb < tournoi1.total_turn:
|
||||||
tournoi1.current_turn = turn_nb
|
tournoi1.current_turn = turn_nb
|
||||||
run_turn(turn_nb)
|
run_turn(turn_nb)
|
||||||
turn_nb += 1
|
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("\nLe", tournoi1.name, "est terminé.\n")
|
||||||
print("Scores finaux:\n", participants.data)
|
print("Scores finaux:\n", participants.data)
|
||||||
|
print("Le vainqueur est :\n", winner)
|
||||||
print("liste des tours:\n", tournoi1.turn_list)
|
print("liste des tours:\n", tournoi1.turn_list)
|
||||||
|
|
||||||
#for i in range(1, tournoi1.total_turn+1):
|
#for i in range(1, tournoi1.total_turn+1):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user