Beispiel #1
0
        def inner(*args, **kwargs):
            game_id = kwargs["game_id"]
            state = db.load_game_state(game_id)
            game = Game(state)
            result = func(*args, **kwargs, game=game)

            if save:
                db.save_game_state(game_id, game.get_state(),
                                   datetime.datetime.now())

            return result
Beispiel #2
0
def create_game():
    game = Game()
    player_1 = request.form.get('player_1_name')
    player_2 = request.form.get('player_2_name')
    player_3 = request.form.get('player_3_name')
    player_4 = request.form.get('player_4_name')
    player_5 = request.form.get('player_5_name')
    player_6 = request.form.get('player_6_name')
    players = [
        i
        for i in [player_1, player_2, player_3, player_4, player_5, player_6]
        if i and i != ""
    ]
    game.start_game(players)
    game_id = db.save_game_state(None, game.get_state(),
                                 datetime.datetime.now())
    return redirect(url_for("view", game_id=game_id))