Final code version before submitting
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user