コード例 #1
0
    def set_influence(self, influence_sources, abort_on_friendly):
        self.map = np.zeros((self.gamestate.rows, self.gamestate.cols))
        if len(influence_sources) == 0:
            return
        np_temp_maps = np.zeros((len(influence_sources), self.gamestate.rows, self.gamestate.cols), dtype=np.int)
        for i in range(len(influence_sources)):
            initial_loc, initial_value = influence_sources[i]
            self.get_map_for_single_loc(np_temp_maps[i], initial_loc, initial_value, abort_on_friendly)

        perf_logger.debug('set_influence.merge start: %s' % str(self.gamestate.time_elapsed()))
        perf_logger.debug('np_temp_maps.shape = %s' % str(np_temp_maps.shape))
        merge_linear_map(np_temp_maps, self.map)
        perf_logger.debug('set_influence.finish: %s' % str(self.gamestate.time_elapsed()))
コード例 #2
0
 def set_influence(self, influence_sources, abort_condition):
     perf_logger.debug('set_influence.start: %s' % str(self.gamestate.time_remaining()))
     self.map = np.zeros((self.gamestate.rows, self.gamestate.cols))
     if len(influence_sources) == 0:
         return
     temp_maps = []
     for initial_loc, initial_value in influence_sources:
         temp_maps.append(self.get_map_for_single_loc(initial_loc, initial_value, abort_condition))        
     np_temp_maps = np.array(temp_maps)
     perf_logger.debug('set_influence.merge start: %s' % str(self.gamestate.time_remaining()))
     perf_logger.debug('np_temp_maps.shape = %s' % str(np_temp_maps.shape))
     merge_linear_map(np_temp_maps, self.map)
     perf_logger.debug('set_influence.finish: %s' % str(self.gamestate.time_remaining()))
コード例 #3
0
    def set_influence(self, influence_sources, abort_on_friendly):
        self.map = np.zeros((self.gamestate.rows, self.gamestate.cols))
        if len(influence_sources) == 0:
            return
        np_temp_maps = np.zeros(
            (len(influence_sources), self.gamestate.rows, self.gamestate.cols),
            dtype=np.int)
        for i in range(len(influence_sources)):
            initial_loc, initial_value = influence_sources[i]
            self.get_map_for_single_loc(np_temp_maps[i], initial_loc,
                                        initial_value, abort_on_friendly)

        perf_logger.debug('set_influence.merge start: %s' %
                          str(self.gamestate.time_elapsed()))
        perf_logger.debug('np_temp_maps.shape = %s' % str(np_temp_maps.shape))
        merge_linear_map(np_temp_maps, self.map)
        perf_logger.debug('set_influence.finish: %s' %
                          str(self.gamestate.time_elapsed()))