Exemplo n.º 1
0
def view_execute_instructions(id, instruction):
    maze = db_get_maze(id)
    if maze is None:
        return jsonify({"error" : "Maze not found"}), 404
    elif instruction is None:
        return jsonify({"error" : "Empty instruction"}), 400
    
    success, instructions = runtime.compile(instruction)
    if not success:
        return jsonify(instructions), 200

    result = runtime.run_instructions(maze, instructions)
    print(result)
    return jsonify(result), 200
Exemplo n.º 2
0
def view_get_maze(id):
    maze = db_get_maze(id)
    if maze is None:
        return jsonify({}), 404
    return jsonify(maze), 200