def play(self, board, player, step, time_left):
     """This function is used to play a move according
     to the board, player and time left provided as input.
     It must return an action representing the move the player
     will perform.
     """
     #Launch
     if (step == 1 or step == 2):
         self.gametime = time_left
     if (step == 1):
         # Hard codage de la 1�re action pour �viter une perte de temps
         return (3, 8, 4, 7)
     #Init minmax
     newBoard = avalamFinal.Board(board.get_percepts(player==avalamFinal.PLAYER2))
     state = (newBoard, player, step)
     self.maxMinMaxDepth = calculate_maxMinMaxDepth(step, time_left, self.gametime, newBoard.estimate_depth_safety())
     self.maxTimeForMinMax = datetime.datetime.now() + datetime.timedelta(0, getTimeSituation(step, time_left, self.gametime))
     #Debug
     print("Depth :", self.maxMinMaxDepth)
     print("Time :", getTimeSituation(step, time_left, self.gametime))
     print("Time left : ", time_left)
     #Minmax
     minmaxRes = minimaxFinal.search(state, self, time_left)
     print(minmaxRes)
     if minmaxRes == None:
         self.maxMinMaxDepth = 2
         minmaxRes = minimaxFinal.search(state, self, time_left)
     return minmaxRes
 def play(self, board, player, step, time_left):
     """This function is used to play a move according
     to the board, player and time left provided as input.
     It must return an action representing the move the player
     will perform.
     """
     #Launch
     if (step == 1 or step == 2):
         self.gametime = time_left
     if (step == 1):
         # Hard codage de la 1�re action pour �viter une perte de temps
         return (3, 8, 4, 7)
     #Init minmax
     newBoard = avalamFinal.Board(
         board.get_percepts(player == avalamFinal.PLAYER2))
     state = (newBoard, player, step)
     self.maxMinMaxDepth = calculate_maxMinMaxDepth(
         step, time_left, self.gametime, newBoard.estimate_depth_safety())
     self.maxTimeForMinMax = datetime.datetime.now() + datetime.timedelta(
         0, getTimeSituation(step, time_left, self.gametime))
     #Debug
     print("Depth :", self.maxMinMaxDepth)
     print("Time :", getTimeSituation(step, time_left, self.gametime))
     print("Time left : ", time_left)
     #Minmax
     minmaxRes = minimaxFinal.search(state, self, time_left)
     print(minmaxRes)
     if minmaxRes == None:
         self.maxMinMaxDepth = 2
         minmaxRes = minimaxFinal.search(state, self, time_left)
     return minmaxRes
 def play(self, board, player, step, time_left):
     """This function is used to play a move according
     to the board, player and time left provided as input.
     It must return an action representing the move the player
     will perform.
     """
     # Launch
     newBoard = avalamFinal.Board(board.get_percepts(player == avalamFinal.PLAYER2))
     state = (newBoard, player, step)
     self.maxMinMaxDepth = max(calculate_maxMinMaxDepth(step, time_left), newBoard.estimate_depth_safety() + 1)
     # Debug
     print("Depth :", self.maxMinMaxDepth)
     print("Time left : ", time_left)
     return minimaxFinal.search(state, self, time_left)
Beispiel #4
0
    def play(self, board, player, step, time_left):
        """This function is used to play a move according
        to the board, player and time left provided as input.
        It must return an action representing the move the player
        will perform.
        """
        #Launch
        newBoard = avalamDropper.Board(board.get_percepts(player==avalamDropper.PLAYER2))
        state = (newBoard, player, step)
        self.maxMinMaxDepth = calculate_maxMinMaxDepth(step, time_left) + newBoard.estimate_depth_safety()
        #Debug
        print("Depth :", self.maxMinMaxDepth)
        print("Time left : ", time_left)

        return minimaxFinal.search(state, self)