示例#1
0
def main():
    # GAME 1
    # Create strategies
    strategy_A = StaticStrategy('The Great Destroyer', [33, 33, 34],
                                shuffle=True)
    strategy_B = StaticStrategy('The Even More Destroyer', [51, 47, 2])

    # Set up game
    gm = GameManager(strategy_A,
                     strategy_B,
                     num_fields=3,
                     num_runs=100,
                     total_score=True)
    gm.run()
    gm.plot_results()
    gm.declare_winner()

    # GAME 2
    # Create strategies
    strategy_A = StaticStrategy('The Great Destroyer 2', [33, 33, 34],
                                shuffle=True)
    strategy_B = StaticStrategy('The Even More Destroyer 2', [51, 47, 2])

    # Set up game
    gm = GameManager(strategy_A,
                     strategy_B,
                     num_fields=3,
                     num_runs=100,
                     total_score=False)
    gm.run()
    gm.plot_results()
    gm.declare_winner()
示例#2
0
def main():
    # GAME 1
    # Create strategies
    strategy_A = StaticStrategy('The Destroyer', [51, 47, 2], shuffle=False)
    strategy_B = StaticStrategy('The Shuffling Destroyer', [51, 47, 2],
                                shuffle=True)
    strategy_C = CounterStrategy('The Counter')

    # Run games
    gm = GameManager(strategy_A,
                     strategy_C,
                     num_fields=3,
                     num_runs=100,
                     total_score=True)
    gm.run()
    gm.plot_results()
    gm.declare_winner()

    # Run games
    gm = GameManager(strategy_B,
                     strategy_C,
                     num_fields=3,
                     num_runs=100,
                     total_score=True)
    gm.run()
    gm.plot_results()
    gm.declare_winner()
示例#3
0
def main():
    # Add you own strategy here instead of StaticStrategy
    my_strat = StaticStrategy('MyStrat', [25, 25, 25, 25, 0, 0, 0, 0], shuffle=True)

    # Create opponent
    opponent = RandomStrategy('RandomStrategy', style=RandomStyle.UNIFORM)

    # Set up game
    gm = GameManager(my_strat, opponent, num_fields=8, num_runs=1)
    gm.run()
    # Uncomment this if you have matplotlib
    # gm.plot_results()
    gm.declare_winner()
示例#4
0
def main():
    from Strategies.RandomStrategy import RandomStrategy, RandomStyle
    from GameManager import GameManager

    strategy_a = SnoopDog("Snoop!")
    strategy_b = RandomStrategy("Rando", [0.4, 0.4, 0.2],
                                shuffle=True,
                                style=RandomStyle.NUMBER)

    gm = GameManager(strategy_a, strategy_b, 3, 30, total_score=False)
    gm.run()
    gm.plot_results()
    gm.declare_winner()
示例#5
0
def main():
    # Add you own strategy here instead of StaticStrategy
    camz = CamzBattle('Camz',
                      "/home/cameron/Code/Blotto/data/camz_strategy.json")
    snoop = SnoopDogg('Snoop')

    # Create opponent
    scroggs = Scroggs('Scroggs')

    # Set up game
    gm = GameManager(snoop, scroggs, num_fields=8, num_runs=1000)
    gm.run()
    # Uncomment this if you have matplotlib
    gm.plot_results()
    gm.declare_winner()
示例#6
0
def main():
    # GAME 1
    # Create strategies
    a_1 = StaticStrategy('a_1', [50, 49, 1], shuffle=True)
    a_2 = StaticStrategy('a_2', [35, 60, 5], shuffle=True)

    strategy_A = MixedStrategy('MixedStart A', [a_1, a_2], [0.5, 0.5])
    strategy_B = RandomStrategy('Random Strat B', [0.50, 0.485, 0.015],
                                shuffle=True)

    # Set up game
    gm = GameManager(strategy_A,
                     strategy_B,
                     num_fields=3,
                     num_runs=10000,
                     total_score=True)
    gm.run()
    gm.plot_results()
    gm.declare_winner()
示例#7
0
def main():
    # GAME 1
    # Create strategies
    strategy_A = RandomStrategy('The Great Destroyer', [1/3.0, 1/3.0, 1/3.0], shuffle=True)
    strategy_B = RandomStrategy('The Even More Destroyer', [0.4, 0.4, 0.2])

    # Set up game
    gm = GameManager(strategy_A, strategy_B, num_fields=3, num_runs=1000, total_score=True)
    gm.run()
    gm.plot_results()
    gm.declare_winner()

    # GAME 2
    # Create strategies
    strategy_A = RandomStrategy('The Great Destroyer 2', [0.51, 0.48, 0.01], shuffle=True)
    strategy_B = RandomStrategy('The Even More Destroyer 2', [0.5, 0.5, 0.0], shuffle=True)

    # Set up game
    gm = GameManager(strategy_A, strategy_B, num_fields=3, num_runs=1000, total_score=False)
    gm.run()
    gm.plot_results()
    gm.declare_winner()
示例#8
0
__author__ = 'camzzz'

from GameManager import GameManager

from Strategies.CamzStrategy import CamzLearner
from Strategies.Scroggs import Scroggs
from Strategies.RandomStrategy import RandomStrategy, RandomStyle
from Strategies.MixedStrategy import MixedStrategy

c = CamzLearner('camz', '/home/cameron/Code/Blotto/data/beat_unif.json', keep_fct=1.0, add_fct=1.0)
s = Scroggs('scroggs')
r = RandomStrategy('r', style=RandomStyle.UNIFORM)
m = MixedStrategy('scroggs_and_unif', [s, r], [0.9, 0.1])


gm = GameManager(r, c, 8, 10000)

gm.run()gt
gm.plot_results()
gm.declare_winner()


#c.crop_db()
c.store_db()