Пример #1
0
 def search(self, current_state, info_set, init_max_depth):
     '''
     @param info_set: info set of current_state
     '''        
     # start iterative search
     curr_max_depth = init_max_depth
     # print "time left", end_time - time.clock(), "d=", curr_max_depth
     
     while True:
         EndTimer.check("start search")
         print  "time left", EndTimer.time_left(), "d=", curr_max_depth
         alg = SmartAlphaBetaSearch(self.player, self.utility, self.turn_cache, self.winner_check,self.use_quads)
         self.res_action, self.res_state, self.res_info_set = alg.search(current_state, curr_max_depth, info_set)
         curr_max_depth += self.depth_delta #TODO: TODO
Пример #2
0
    def search(self, current_state, info_set, init_max_depth):
        """
        @param info_set: info set of current_state
        """
        # start iterative search
        curr_max_depth = init_max_depth
        print init_max_depth
        # print "time left", end_time - time.clock(), "d=", curr_max_depth
        alg = SmartAlphaBetaSearch(
            self.player, self.utility, self.turn_cache, self.time_statistics, self.node_statistics, self.winner_check
        )

        while True:
            EndTimer.check("start search")

            self.node_statistics.start_monitor(curr_max_depth)
            r = alg.search(current_state, curr_max_depth, info_set)
            self.node_statistics.stop_monitor(curr_max_depth)

            self.res_action, self.res_state, self.res_info_set = r
            print "Solution at depth:", curr_max_depth, "  time left:", EndTimer.time_left()
            curr_max_depth += self.depth_delta