def main(): # Set the global logging level (Set to debug or info to see more messages) logging.basicConfig(level=logging.WARNING) # setup the arena arena = ArenaCheating(jass_type=JASS_SCHIEBER_1000, trump_strategy=TrumpPlayerStrategy(), play_game_strategy=PlayNrRoundsStrategy(4)) player = RandomPlayerSchieber() #player = MyMCTSPlayer() #set my player #my_player = MyMinimaxPlayer() my_player = MyMCTSPlayer() arena.set_players(my_player, player, my_player, player) arena.nr_games_to_play = 10 print('Playing {} games'.format(arena.nr_games_to_play)) arena.play_all_games() total_games = arena.nr_wins_team_0 + arena.nr_wins_team_1 + arena.nr_draws print('Wins Team 0: {} ({:.2f}%)'.format( arena.nr_wins_team_0, arena.nr_wins_team_0 / total_games)) print('Wins Team 1: {} ({:.2f}%)'.format( arena.nr_wins_team_1, arena.nr_wins_team_1 / total_games)) print('Draws: {} ({:.2f}%)'.format(arena.nr_draws, arena.nr_draws / total_games)) print('Delta Points: {}'.format(arena.delta_points))
def main(n_games): arena = Arena(jass_type=JASS_SCHIEBER_2500, trump_strategy=TrumpPlayerStrategy(), play_game_strategy=PlayNrRoundsStrategy(4)) randy = RandomPlayerSchieber() donat = DonatTrump() kurtoid = Kurtoid() permutoid = Permutoid() carloid = Carloid(3) trumpruloid = Trumpruloid() trumpcarloid = Trumpcarloid(3) arena.set_players(trumpcarloid, kurtoid, trumpcarloid, kurtoid) arena.nr_games_to_play = n_games arena.play_all_games() kurtoid_wins = arena.nr_wins_team_0 opponent_wins = arena.nr_wins_team_1 draws = arena.nr_draws total = kurtoid_wins + opponent_wins + draws print('Our Team {:4d} {:5.1f}%'.format(kurtoid_wins, kurtoid_wins / total * 100)) print('Opponents {:4d} {:5.1f}%'.format(opponent_wins, opponent_wins / total * 100)) print('Draws {:4d} {:5.1f}%'.format(draws, draws / total * 100)) print('Δ Points {:4d}'.format(arena.delta_points))
def simulateRound(self, node: Node): rnd = get_round_from_player_round(node.getAction().getRound(), node.getAction().getRound().hands) rnd.action_play_card(node.getAction().getCard()) cards = rnd.nr_played_cards randomPlayer = RandomPlayerSchieber() while cards < 36: player_rnd = PlayerRoundCheating() player_rnd.set_from_round(rnd) card_action = randomPlayer.play_card(player_rnd) rnd.action_play_card(card_action) cards += 1 myPoints = rnd.points_team_0 pointsEnemy = rnd.points_team_1 maxPoints = myPoints + pointsEnemy if myPoints > pointsEnemy: return (myPoints - 0) / (maxPoints - 0) else: return 0
def create_app(): app = PlayerServiceApp('kurtoid_service') app.add_player('Kurt', Kurtoid()) app.add_player('Maurin', DonatTrump()) app.add_player('Randy', RandomPlayerSchieber()) app.add_player('Permi', Permutoid()) for depth in range(5): player_name = 'Carlo{:d}'.format(depth) app.add_player(player_name, Carloid(depth)) app.add_player('Trumpruler', Trumpruloid()) return app
def create_app(): """ This is the factory method for flask. It is automatically detected when flask is run, but we must tell flask what python file to use: export FLASK_APP=my_player_service.py export FLASK_ENV=development flask run --host=0.0.0.0 --port=8888 """ logging.basicConfig(level=logging.DEBUG) # create and configure the app app = PlayerServiceApp('my_player_service') # you could use a configuration file to load additional variables # app.config.from_pyfile('my_player_service.cfg', silent=False) # add some players app.add_player('DeepLearningForNothing', CompleteMLPlayer()) app.add_player('random', RandomPlayerSchieber()) return app