adjust match issue, add total score to tournament display

This commit is contained in:
2025-02-13 15:44:04 +01:00
parent d115126afb
commit 29a56eceaa
3 changed files with 48 additions and 32 deletions

View File

@@ -110,6 +110,7 @@ class Application:
def run_tournament(self):
shuffle(self.tournament.players_list)
self.view.display_players(self.tournament.players_list)
for each_round in range(1, self.tournament.total_round + 1):
self.tournament.current_round += 1
self.round = Round()
@@ -119,6 +120,7 @@ class Application:
self.round.start_time = self.round.get_time()
# create matches TODO : check from history
self.round.match_list = self.create_match()
self.match_history.add(self.round.match_list)
# display matches
self.view.display_matches(self.round.match_list)
self.view.prompt_for_scores()
@@ -156,9 +158,15 @@ class Application:
for i in range(0, len(self.tournament.players_list), 2):
j += 1
match = Match()
match.player1 = self.tournament.players_list[i]
match.player2 = self.tournament.players_list[i+1]
match_list.append(match)
try:
match.player1 = self.tournament.players_list[i]
match.player2 = self.tournament.players_list[i+1]
if self.match_history.check(match):
# match.player2 = self.tournament.players_list[i+2]
print("deja joue")
match_list.append(match)
except IndexError:
pass
return match_list
def scores(self, match_list) -> list: