def do_actions(id, coin): game = Game.load(id) data = request.json actions.execute(game, coin, data['action'], data.get('data', None)) return game.to_dict()
def list_games(): return {'games': [g.to_dict() for g in Game.find_by_status('new')]}
def show_game(id): return Game.load(id).to_dict()
def join_game(id): game = Game.load(id) game.join() return game.to_dict()
def create_games(): game = Game.make_new() return game.to_dict()
def my_game(): return Game.find_by_active_by_client().to_dict()
def draft(id): game = Game.load(id) data = request.json game.cards.do_draft(data['pick']) return game.to_dict()
def get_actions(id, coin): game = Game.load(id) return actions.get_possible(game, coin)