diff --git a/src/classes/Engines.py b/src/classes/Engines.py index 6be23b4..338d48b 100644 --- a/src/classes/Engines.py +++ b/src/classes/Engines.py @@ -214,7 +214,6 @@ class MinmaxDeepeningPlayerEngine(MinmaxPlayerEngine): # Get an alarm signal to stop iterations signal.signal(signal.SIGALRM, self.alarm_handler) signal.alarm(self.options['time_limit']) - depth = self.options['depth'] heuristic = -math.inf move = None @@ -223,6 +222,11 @@ class MinmaxDeepeningPlayerEngine(MinmaxPlayerEngine): max_depth = (board.get_board_size()**2) - ( board.get_nb_pieces()[0] + board.get_nb_pieces()[1]) + depth = self.options['depth'] if self.options['depth'] <= max_depth else max_depth + + # Iterate depth while our alarm does not trigger and there is enougth + # avaiable move to play + # Iterate depth while our alarm does not trigger and there is enougth # avaiable move to play while not self.interrupt_search and depth <= max_depth: @@ -254,7 +258,6 @@ class AlphaBetaDeepeningPlayerEngine(AlphabetaPlayerEngine): # Get an alarm signal to stop iterations signal.signal(signal.SIGALRM, self.alarm_handler) signal.alarm(self.options['time_limit']) - depth = self.options['depth'] heuristic = -math.inf move = None @@ -263,6 +266,8 @@ class AlphaBetaDeepeningPlayerEngine(AlphabetaPlayerEngine): max_depth = (board.get_board_size()**2) - ( board.get_nb_pieces()[0] + board.get_nb_pieces()[1]) + depth = self.options['depth'] if self.options['depth'] <= max_depth else max_depth + # Iterate depth while our alarm does not trigger and there is enougth # avaiable move to play while not self.interrupt_search and depth <= max_depth: