Final code version before submitting

This commit is contained in:
2023-09-18 20:11:39 +01:00
parent e34df3a166
commit 5b253369ee
20 changed files with 1663 additions and 1495 deletions
+9 -1
View File
@@ -2,11 +2,19 @@ import random
from math import inf
from utilities.constants import GREEN, WHITE
from utilities.gameManager import GameManager
class MiniMax:
def AI(self, depth, maxPlayer, gameManager):
def AI(self, depth: int, maxPlayer: int, gameManager: GameManager) -> tuple:
"""
The minimax algorithm
:param depth: How deep the algorithm should go
:param maxPlayer: The current player
:param gameManager: The game manager
:return: the best evaluation and board
"""
if depth == 0 or gameManager.board.winner() is not None:
return gameManager.board.scoreOfTheBoard(), gameManager.board