def ping_reply(game, player=None): return dict({'message': '', 'state': Player.game_state(game.name), 'gamesig': game.signature(), 'next': 2000, 'ok': True}, **(player and {'player': player.uid} or {}))
def game(game): return {'message': '', 'name': game.name, 'turn': game.who(), 'over': game.board.game_over, 'state': Player.game_state(game.name), 'gamesig': game.signature(), 'scores': game.scores(), 'data': game.board.take_snapshot()}
def game(game, branch=None): try: board = game.get_board(branch) except GameError: raise bottle.HTTPResponse({'message': "Cannot load branch"}, 404) return dict({'message': '', 'name': game.name, 'turn': board.player_turn(), 'over': board.game_over, 'gamesig': game.signature(branch), 'scores': game.scores(), 'data': board.take_snapshot()}, #Include data that's not relevant unless we're looking at HEAD **(not branch and {'state': Player.game_state(game.name)} or {}));
def ping_game(game): return {'message': '', 'state': Player.game_state(game.name), 'gamesig': game.signature(), 'ok': True}
def ping_player(game, player): return {'message': '', 'player': player.uid, 'state': Player.game_state(game.name), 'gamesig': game.signature(), 'ok': True}