def init(data):
    '\n    Initialize grid and update cell values\n\n\n    @param data -> Json response from bottle\n\n    @return game_id -> Game id for debuggin purposes when displaying grid\n\n    @return grid -> Grid with updated cell values\n\n    @return food -> Sorted array of food by closest to charlie\n\n    @return charlie -> My snake\n\n    @return enemies -> Array of all enemy snakes\n\n    @return check_food -> Secondary grid to look ahead when eating food\n    '
    food = []
    enemies = []
    grid = GameBoard(data['board']['height'], data['board']['width'])
    check_food = GameBoard(data['board']['height'], data['board']['width'])
    charlie = Snake(data['you'])
    for i in data['board']['food']:
        food.append([i['x'], i['y']])
        grid.set_cell([i['x'], i['y']], FOOD)
        check_food.set_cell([i['x'], i['y']], FOOD)
    for snake in data['board']['snakes']:
        snake = Snake(snake)
        for coord in snake.coords:
            grid.set_cell(coord, SNAKE)
            check_food.set_cell(coord, SNAKE)
        if ((snake.health < 100) and (snake.length > 2) and (data['turn'] >= 3)):
            grid.set_cell(snake.tail, SAFTEY)
            check_food.set_cell(snake.tail, SAFTEY)
        if (snake.id != charlie.id):
            for neighbour in neighbours(snake.head, grid, 0, snake.coords, [1]):
                if (snake.length >= charlie.length):
                    grid.set_cell(neighbour, DANGER)
                    check_food.set_cell(neighbour, DANGER)
            enemies.append(snake)
    food = sorted(food, key=(lambda p: distance(p, charlie.head)))
    game_id = data['game']['id']
    return (game_id, grid, food, charlie, enemies, check_food)
Initialize grid and update cell values


@param data -> Json response from bottle

@return game_id -> Game id for debuggin purposes when displaying grid

@return grid -> Grid with updated cell values

@return food -> Sorted array of food by closest to charlie

@return charlie -> My snake

@return enemies -> Array of all enemy snakes

@return check_food -> Secondary grid to look ahead when eating food
def init(data):
    '\n    Initialize grid and update cell values\n\n\n    @param data -> Json response from bottle\n\n    @return game_id -> Game id for debuggin purposes when displaying grid\n\n    @return grid -> Grid with updated cell values\n\n    @return food -> Sorted array of food by closest to charlie\n\n    @return charlie -> My snake\n\n    @return enemies -> Array of all enemy snakes\n\n    @return check_food -> Secondary grid to look ahead when eating food\n    '
    food = []
    enemies = []
    grid = GameBoard(data['board']['height'], data['board']['width'])
    check_food = GameBoard(data['board']['height'], data['board']['width'])
    charlie = Snake(data['you'])
    for i in data['board']['food']:
        food.append([i['x'], i['y']])
        grid.set_cell([i['x'], i['y']], FOOD)
        check_food.set_cell([i['x'], i['y']], FOOD)
    for snake in data['board']['snakes']:
        snake = Snake(snake)
        for coord in snake.coords:
            grid.set_cell(coord, SNAKE)
            check_food.set_cell(coord, SNAKE)
        if ((snake.health < 100) and (snake.length > 2) and (data['turn'] >= 3)):
            grid.set_cell(snake.tail, SAFTEY)
            check_food.set_cell(snake.tail, SAFTEY)
        if (snake.id != charlie.id):
            for neighbour in neighbours(snake.head, grid, 0, snake.coords, [1]):
                if (snake.length >= charlie.length):
                    grid.set_cell(neighbour, DANGER)
                    check_food.set_cell(neighbour, DANGER)
            enemies.append(snake)
    food = sorted(food, key=(lambda p: distance(p, charlie.head)))
    game_id = data['game']['id']
    return (game_id, grid, food, charlie, enemies, check_food)