def input_command(game_id, command): words = command.split('/') gameEntry = models.GameEntry(game_id) g = gameEntry.game g = play_cli.run_command_on_game(g, ' '.join(words)) gameEntry.update_game(g) d = textDisplay.Display(g) s = d.get() return render_template('textgame.html', gameEntry=gameEntry, game=g, command=' '.join(words), gamestring=s)
def display_game_text(game_id): """View and play a risk game in text mode""" gameEntry = models.GameEntry(game_id) g = gameEntry.game if request.method == 'POST': cmd = request.form['cmd'] g = play_cli.run_command_on_game(g, cmd) models.GameEntry(game_id).update_game(g) else: cmd = None d = textDisplay.Display(g) s = d.get() return render_template('textgame.html', gameEntry=gameEntry, game=g, command=cmd, gamestring=s)