def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name) # loads score chart from file self.score_chart = scorechart.from_file( Config.get_instance().get(Config.SCORECHART_FILE) )
def __init__(self, strategy_name, config_name): super(FictitiousPlay, self).__init__(strategy_name) config = Config.get_instance() if config_name is None: raise Exception('Fictitious Play must have a configuration specified at the initialization time') self.set_config_name(config_name) # read score chart from a file self.score_chart = scorechart.from_file( config.get(Config.SCORECHART_FILE) ) # get weights self.initial_weights = config.get(self.config_name)[Config.FICTITIOUS_INITIAL_WEIGHTS] self.running_weights = config.get(self.config_name)[Config.FICTITIOUS_RUNNING_WEIGHTS] # set counters # Note: self.bot_list can't be used here because it isn't initialized from the config file yet self.opponent_choice_counter = {choice_name: self.initial_weights[choice_name] for choice_name in config.get_bots()} self.count_sum = sum([x for _, x in self.opponent_choice_counter.items()]) # set config og stochastic feature. Default value is True if self.STOCHASTIC_TAG in config.get(self.config_name): self.be_stochastic = config.get(self.config_name)[self.STOCHASTIC_TAG] else: self.be_stochastic = True
def __init__(self, strategy_name): """Build second-guessers for 50 strategies: 36 history-based strategies, 12 simple frequency-based strategies, the constant-move strategy, and the basic random-number-generator strategy. Also build 6 meta second guessers to evaluate 6 different time horizons on which to score the 50 strategies' second-guesses.""" super(Iocaine, self).__init__(strategy_name) config = Config.get_instance() self.strategy_name = strategy_name self.predictors = [] self.predict_history = self.predictor((len(ages), 2, 3)) self.predict_frequency = self.predictor((len(ages), 2)) self.predict_fixed = self.predictor() self.predict_random = self.predictor() self.predict_meta = [Predictor() for _ in xrange(len(ages))] self.stats = [Stats(num=len(config.data[config.BOTS])) for _ in xrange(2)] self.histories = [[], [], []] # read score chart from a file self.score_chart = scorechart.from_file( config.get(Config.SCORECHART_FILE), self.bot_list ) # Returns who x beats (limited by n) self._beats = lambda x, n=-1: get_beats_list(self.score_chart, x, n=n) # Returns who x loses to (limited by n) self._loses_to = lambda x, n=-1: get_loses_to_list(self.score_chart, x, n=n)
def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name) # uses score chart to determine best response self.score_chart = scorechart.from_file( Config.get_instance().get(Config.SCORECHART_FILE) )
def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name) # uses score chart to determine best response self.score_chart = scorechart.from_file( Config.get_instance().get(Config.SCORECHART_FILE), self.bot_list )
def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name) self.result_list = [] self.match_list = [] config = Config.get_instance() # read score chart from a file self.score_chart = scorechart.from_file( config.get(Config.SCORECHART_FILE)) # get weights self.regrets = config.get(Config.INITIAL_REGRETS)
def __init__(self, strategy_name): StrategyBase.__init__(self, strategy_name) self.result_list = [] self.match_list = [] config = Config.get_instance() # read score chart from a file self.score_chart = scorechart.from_file( config.get(Config.SCORECHART_FILE) ) # get weights self.regrets = config.get(Config.INITIAL_REGRETS)