Randomize first player after overwritting print/input
This commit is contained in:
parent
4489c95ddc
commit
30513c6acd
2 changed files with 6 additions and 2 deletions
|
@ -26,8 +26,6 @@ class Game():
|
|||
else:
|
||||
self.players.append(Computer(self.board))
|
||||
|
||||
random.shuffle(self.players)
|
||||
|
||||
@property
|
||||
def player1(self):
|
||||
if type(self.players[0]) == Computer:
|
||||
|
@ -49,6 +47,10 @@ class Game():
|
|||
return self.players[(self.round + 1) % 2]
|
||||
|
||||
|
||||
def ready(self):
|
||||
random.shuffle(self.players)
|
||||
|
||||
|
||||
def isFinished(self):
|
||||
return self.board.isFinished() or self.player1.cantpioche or self.player2.cantpioche
|
||||
|
||||
|
|
|
@ -184,6 +184,8 @@ while True:
|
|||
game.current_player.print("\033[91m%s\033[0m" % e)
|
||||
|
||||
|
||||
game.ready()
|
||||
|
||||
while not game.isFinished():
|
||||
with open('saved_games.pickle', 'wb') as f:
|
||||
ip1 = game.player1.input
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue