print('Player %d wins!' % (self.player1_color)) elif p2Stones > p1Stones: print('Player %d wins!' % (self.player2_color)) else: print('Draw') print('\n-----------------------------\n\n') if __name__ == "__main__": (choices, args) = getopt.getopt(sys.argv[1:], "") p1_color = 0 p2_color = 1 if len(args) == 0: print('No arguments given.\nRunning game with two random players.') p1 = random_player.MyPlayer(p1_color, p2_color) p2 = random_player.MyPlayer(p2_color, p1_color) game = HeadlessReversiCreator(p1, p1_color, p2, p2_color, 8) game.play_game() elif len(args) == 1: print( 'One player given in argument.\nRunning game with given player aginst the random player.' ) p1 = random_player.MyPlayer(p1_color, p2_color) try: player_module = __import__(args[0]) p2 = player_module.MyPlayer(p2_color, p1_color) game = HeadlessReversiCreator(p1, p1_color, p2, p2_color, 8) game.play_game()
print('Player %d wins!' % (self.player2_color)) else: print('Draw') print('\n-----------------------------\n\n') if __name__ == "__main__": (choices, args) = getopt.getopt(sys.argv[1:], "") p0_color = 0 p1_color = 1 if len(args) == 0: print( 'No arguments given.\nRunning game with my player against a random player.' ) p0 = random_player.MyPlayer(p0_color, p1_color) p1 = player.MyPlayer(p1_color, p0_color) game = HeadlessReversiCreator(p0, p0_color, p1, p1_color, 8) game.play_game() elif len(args) == 1: print( 'One player given in argument.\nRunning game with given player against the random player.' ) p0 = random_player.MyPlayer(p0_color, p1_color) try: player_module = __import__(args[0]) p1 = player_module.MyPlayer(p1_color, p0_color) game = HeadlessReversiCreator(p0, p0_color, p1, p1_color, 8) game.play_game()