Example #1
0
def game(args):
    strategies = {'basic':  Basic,
                  'human':  Human}
    player1 = strategies.get(args['--player1'], None)
    player2 = strategies.get(args['--player2'], None)
    if player1 is None:
        exit("{0} is not a valid strategy. The valid strategies are: basic, human".format(args['--player1']))
    if player2 is None:
        exit("{0} is not a valid strategy. The valid strategies are: basic, human".format(args['--player2']))
    print "A new game is created."
    print
    print "-1 = Empty, 0 = Red, 1 = Green"
    print
    new_game = Game()
    basic.ALPHA_BETA_MAX_DEPTH = int(args['--max-depth'])
    new_game.registerPlayer(player1())
    color_int = new_game.players[0].color
    print "Player 1: {0} with color {1} ({2})".format(player1.__name__, disc.color_string(color_int), color_int)
    new_game.registerPlayer(player2())
    color_int = new_game.players[1].color
    print "Player 2: {0} with color {1} ({2})".format(player2.__name__, disc.color_string(color_int), color_int)
    print
    print
    new_game.playLoop()