Beispiel #1
0
 def run_n_games(num_games):
     stats = {player: 0 for player in flat_names}
     for i in xrange(num_games):
         players = init_new_players(teams, names, caps)
         m = Monopoly(players=players)
         m.run(turns_per_game)
         if m.winner:
             stats[m.winner.name] += 1
     return stats
Beispiel #2
0
def simulate(turns, games, discount=.05):
    caps = init.simulate("init.csv", turns)

    for i in range(games):
        players = [CapRatePlayer(name="CapPlayer" + str(i), caps=caps) for i in xrange(4)]
        monopoly = Monopoly(players=players)
        monopoly.run(100000)
        caps = combine_caps(caps, monopoly.get_caps())
    return caps
Beispiel #3
0
def simulate_square_counts(turns):
    players = [GreedyPlayer(name="BasicPlayer" + str(i)) for i in xrange(4)]
    monopoly = Monopoly(players=players)
    square_counts = [0 for i in xrange(40)]
    for i in xrange(4 * turns):
        player = monopoly.make_move()
        square_counts[player.position] += 1
    years = monopoly.return_years()
    return (square_counts, years)
Beispiel #4
0
def main():
    caps = io_cap.input_cap_file("100cap.csv")
    players = [BenchmarkPlayer(name="BenchmarkPlayer1"),
               CapRatePlayer(name="CapRatePlayer1", caps=caps)]
    m = Monopoly(players=players, debug_flag=True)
    m.run(10000)