2018/scripts/problema_3_c.py
def position_to_cell(position):
    """
    get position in the 5X5 grid
    """

    x = position["x"]
    y = position["y"]
    if x <= 20:
        cell_x = 0
    elif x > 20 and x <= 40:
        cell_x = 1
    elif x > 40 and x <= 60:
        cell_x = 2
    elif x > 60 and x <= 80:
        cell_x = 3
    elif x > 80:
        cell_x = 4

    if y <= 20:
        cell_y = 0
    elif y > 20 and y <= 40:
        cell_y = 1
    elif y > 40 and y <= 60:
        cell_y = 2
    elif y > 60 and y <= 80:
        cell_y = 3
    elif y > 80:
        cell_y = 4

    return cell_x, cell_y

    get position in the 5X5 grid
    
get position in the 5X5 grid
get position in the 5X5 grid
def position_to_cell(position):
    x = position["x"]
    y = position["y"]
    if x <= 20:
        cell_x = 0
    elif x > 20 and x <= 40:
        cell_x = 1
    elif x > 40 and x <= 60:
        cell_x = 2
    elif x > 60 and x <= 80:
        cell_x = 3
    elif x > 80:
        cell_x = 4
    if y <= 20:
        cell_y = 0
    elif y > 20 and y <= 40:
        cell_y = 1
    elif y > 40 and y <= 60:
        cell_y = 2
    elif y > 60 and y <= 80:
        cell_y = 3
    elif y > 80:
        cell_y = 4
    return cell_x, cell_y
def position_to_cell ( position ) : x = position [ "x" ] y = position [ "y" ] if x <= 20 : cell_x = 0 elif x > 20 and x <= 40 : cell_x = 1 elif x > 40 and x <= 60 : cell_x = 2 elif x > 60 and x <= 80 : cell_x = 3 elif x > 80 : cell_x = 4 if y <= 20 : cell_y = 0 elif y > 20 and y <= 40 : cell_y = 1 elif y > 40 and y <= 60 : cell_y = 2 elif y > 60 and y <= 80 : cell_y = 3 elif y > 80 : cell_y = 4 return cell_x , cell_y
get position in the 5X5 grid
get position in the 5X5 grid
"""
    get position in the 5X5 grid
    """
position