Ejemplo n.º 1
0
 def __init__(self, strategy, name=None):
     self.strategy = strategy
     self.strategy_on = True
     self.strategy_complete = False
     if name is None:
         self.name = 'IdealistComboBot(%s)' % (strategy)
     else:
         self.name = name
     BigMoney.__init__(self, 1, 2)
Ejemplo n.º 2
0
 def __init__(self, strategy, name=None):
     self.strategy = strategy
     self.strategy_on = True
     self.strategy_complete = False
     if name is None:
         self.name = 'IdealistComboBot(%s)' % (strategy)
     else:
         self.name = name
     BigMoney.__init__(self, 1, 2)
Ejemplo n.º 3
0
def calculate_elo_vs_BigMoney(p, ngame = 50):
  """
  Let BigMoney() have elo of 1500. 
  Caluculate elo of some bot
  """
  ngame = ngame
  pb = BigMoney() 
  wins1, fs1 = compare_bots([p,pb],num_games=ngame,order=1)
  wins2, fs2 = compare_bots([pb,p],num_games=ngame,order=1)
  winrate = (wins1[p] + wins2[p])/(2*ngame)
  if winrate == 0:
    return 0
  elif winrate == 1:
    return np.inf
  return -np.log10(1/winrate - 1)*400 
Ejemplo n.º 4
0
def big_money_baseline():
    improvements = np.zeros((30, ))
    counts = np.zeros((30, ), dtype='int32')
    for iteration in xrange(10000):
        game = Game.setup([BigMoney(1, 2)])
        for turn in xrange(30):
            before_value = deck_value(game.state().all_cards())
            game = game.take_turn()
            after_value = deck_value(game.state().all_cards())
            delta = after_value - before_value
            improvements[turn] += delta
            counts[turn] += 1
            if game.over(): break
        avg = [imp / count for imp, count in zip(improvements, counts)]
        print avg
        print counts
    return avg
Ejemplo n.º 5
0
 def buy_priority_order(self, decision):
     if self.strategy_complete:
         return BigMoney.buy_priority_order(self, decision)
     else:
         return [None, c.silver, c.gold, c.province
                 ] + self.strategy_priority
Ejemplo n.º 6
0
 def buy_priority_order(self, decision):
     if self.strategy_complete:
         return BigMoney.buy_priority_order(self, decision)
     else:
         return [None, c.silver, c.gold, c.province] + self.strategy_priority