def create(): data = json.loads(request.data) bot_list = api.get_bots() # make_bot or Agent depending on choice... (unknown name => human) homePlayer = data['game']['home_player'] if homePlayer in bot_list: homeAgent = make_bot(homePlayer) else: homeAgent = Agent("Player 1", human=True) awayPlayer = data['game']['away_player'] if awayPlayer in bot_list: awayAgent = make_bot(awayPlayer) else: awayAgent = Agent("Player 1", human=True) game = api.new_game(data['game']['home_team_name'], data['game']['away_team_name'], homeAgent, awayAgent) return json.dumps(game.to_json())
def get_bots(): return json.dumps(api.get_bots())