-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
74 lines (63 loc) · 2.48 KB
/
Copy pathmain.py
File metadata and controls
74 lines (63 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from gameplay import *
def main():
# Obtenir le choix de langue depuis gameplay.py
language = choose_language()
if language == "fr":
# Texte en français
print("Vous avez choisi le français.\n")
else:
# Texte en anglais
print("You've chosen English.\n")
# Demander le nombre de joueurs et de tours
num_players = int(input("Combien de joueurs ? " if language == "fr" else "How many players? "))
num_rounds = int(input("Combien de tours ? " if language == "fr" else "How many rounds? "))
if language == "fr":
# Texte en français
print("Pour obtenir de l'aide, tapez 'help()' à tout moment.\n")
else:
# Texte en anglais
print("To get help, type 'help()' at any time.\n")
# Jouer le jeu pour le nombre de tours spécifié
scores = num_players * [0]
for i in range(num_rounds):
if language == "fr":
# Texte en français
print(f"\nTour n°{i + 1} !")
else:
# Texte en anglais
print(f"\nRound {i + 1}!")
round_score = play_round(num_players, language)
for j in range(num_players):
scores[j] += round_score[j]
# Trouver le joueur avec le score le plus élevé
max_score = max(scores)
winners = [i + 1 for i, score in enumerate(scores) if score == max_score]
if language == "fr":
# Texte en français
print("\nScores finaux:")
else:
# Texte en anglais
print("\nFinal Scores:")
for i, score in enumerate(scores):
if language == "fr":
# Texte en français
print(f"Joueur {i + 1}: {score}")
else:
# Texte en anglais
print(f"Player {i + 1}: {score}")
if len(winners) == 1:
if language == "fr":
# Texte en français
print(f"\nLe joueur {winners[0]} a gagné avec un score de {max_score}!")
else:
# Texte en anglais
print(f"\nPlayer {winners[0]} has won with a score of {max_score}!")
else:
if language == "fr":
# Texte en français
print(f"\nIl y a une égalité entre les joueurs {', '.join(map(str, winners))} avec un score de {max_score}!")
else:
# Texte en anglais
print(f"\nThere's a tie between players {', '.join(map(str, winners))} with a score of {max_score}!")
if __name__ == "__main__":
main()