-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.py
More file actions
136 lines (109 loc) · 3.85 KB
/
Main.py
File metadata and controls
136 lines (109 loc) · 3.85 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import asyncio
import os
import time
import sys
from package.Game import wholeGame
from package.Players import Player
from package.Shuffle import *
from package.Ending import endGame
from package.Money import table
from package import Print
table = table()
end = endGame()
game = wholeGame()
nbPlayer = game.initGame()
currentPlayer = game.currentPlayer()
Print.startGame()
n = 1
while nbPlayer > 1:
Print.nbRound(n)
time.sleep(1)
deck = shuffleCards()
dealCards(deck, game)
table.resetMoney()
tab = []
for i, _ in enumerate(game.sleepingPlayers()):
tab.append(game.sleepingPlayers()[i])
for player in tab:
game.wakeUp(player)
for _ in range(nbPlayer):
currentPlayer.allIn = False
game.nextPlayer()
currentPlayer = game.currentPlayer()
for a in range(nbPlayer):
game.promptCards(currentPlayer)
print("\n")
game.nextPlayer()
currentPlayer = game.currentPlayer()
table.Ante(game)
table.Choice(game, 1)
if game.checkFoldedPlayers():
currentPlayer = game.currentPlayer()
end.forfaitWinner(currentPlayer, table.totalMoney())
elif game.checkAllIn():
table.allInTotal(1, game, end, deck)
print(f"Argent sur la table: {table.totalMoney()} €")
end.finalCheck(game)
end.whoWon(game, table.totalMoney())
else:
Flop(deck)
table.Choice(game, 2)
if game.checkFoldedPlayers():
currentPlayer = game.currentPlayer()
end.forfaitWinner(currentPlayer, table.totalMoney())
elif game.checkAllIn():
table.allInTotal(2, game, end, deck)
print(f"Argent sur la table: {table.totalMoney()} €")
end.finalCheck(game)
end.whoWon(game, table.totalMoney())
else:
Turn(deck)
table.Choice(game, 3)
if game.checkFoldedPlayers():
currentPlayer = game.currentPlayer()
end.forfaitWinner(currentPlayer, table.totalMoney())
elif game.checkAllIn():
table.allInTotal(3, game, end, deck)
print(f"Argent sur la table: {table.totalMoney()} €")
end.finalCheck(game)
end.whoWon(game, table.totalMoney())
else:
River(deck)
table.Choice(game, 4)
if game.checkFoldedPlayers():
currentPlayer = game.currentPlayer()
end.forfaitWinner(currentPlayer, table.totalMoney())
else:
Print.endOfRound()
printTableRiver(cardsOnTable)
for _ in range(nbPlayer):
currentPlayer.showAllCards()
game.nextPlayer()
currentPlayer = game.currentPlayer()
print(f"Argent sur la table: {table.totalMoney()} €")
end.finalCheck(game)
end.whoWon(game, table.totalMoney())
toKill = []
nbKill = 0
for a in range(nbPlayer):
if currentPlayer.wallet == 0:
nbPlayer -= 1
print(
f"{currentPlayer.name}, vous n'avez malheureusement plus d'argent, vous quittez donc la partie.")
toKill.append(currentPlayer)
nbKill += 1
game.nextPlayer()
currentPlayer = game.currentPlayer()
if len(toKill) > 0:
for a in range(nbKill):
game.Kill(toKill[a])
if nbPlayer > 1:
res = input("Souhaitez vous quitter la partie? (\"oui\"/\"non\") : ")
if res == "oui":
confirm = input("Êtes-vous sûr? (\"oui\"/\"non\") : ")
if confirm == "oui":
break
print("Vous continuez le jeu.")
n += 1
print("Fin de Partie, merci d'avoir joué, à très bientôt! :D")
os.system("pause")