def create_game(self, request): """create a new game """ # look up initiating player slinger = Player.query(Player.player_id == request.player_id).get() if slinger is None: raise endpoints.BadRequestException( 'specified player_id not found') # generate new game game_id = uniq_id() game = Game(game_id=game_id, player_id=slinger.player_id) game.put() # create game history for this game history = History(game=game.key) history.put() return game.to_message()
def start(self, unused_request): game = Game.query().get() if not game: game = Game() game.put() return game.to_message()