ajout de s pour que l'IA commence à jouer

test
Leo TUAILLON 2 years ago
parent 21bf8b1987
commit f29f1280a2

@ -226,6 +226,16 @@ class Game:
self.make_move(row, column) self.make_move(row, column)
self.ai_starts = False self.ai_starts = False
# ...
def start_ai_turn(self):
if self.gamemode == 'ai' and self.player == self.ai.player and self.ai_starts:
row, column = self.ai.evaluate(self.matrix)
self.make_move(row, column)
self.ai_starts = False
# ...
def main(): def main():
# Object of Game class # Object of Game class
@ -251,7 +261,7 @@ def main():
# s-start # s-start
if event.key == pygame.K_s: if event.key == pygame.K_s:
game.ai_starts = not game.ai_starts game.ai_starts = not game.ai_starts
game.ai_first_move() game.start_ai_turn()
#r-restart #r-restart
if event.key == pygame.K_r: if event.key == pygame.K_r:

Loading…
Cancel
Save