def get_valid_cardinals(map_grid, row, column, diaganol):
    valid_cardinals = []
    if (row > 0):
        valid_cardinals.append(c.NORTH)
    if (column > 0):
        valid_cardinals.append(c.WEST)
    if (row < (len(map_grid) - 1)):
        valid_cardinals.append(c.SOUTH)
    if (column < (len(map_grid) - 1)):
        valid_cardinals.append(c.EAST)
    if diaganol:
        if ((row > 0) and (column > 0)):
            valid_cardinals.append(c.NORTHWEST)
        if ((row > 0) and (column < (len(map_grid) - 1))):
            valid_cardinals.append(c.NORTHEAST)
        if ((row < (len(map_grid) - 1)) and (column > 0)):
            valid_cardinals.append(c.SOUTHWEST)
        if ((row < (len(map_grid) - 1)) and (column < (len(map_grid) - 1))):
            valid_cardinals.append(c.SOUTHEAST)
    return valid_cardinals
def get_valid_cardinals(map_grid, row, column, diaganol):
    valid_cardinals = []
    if (row > 0):
        valid_cardinals.append(c.NORTH)
    if (column > 0):
        valid_cardinals.append(c.WEST)
    if (row < (len(map_grid) - 1)):
        valid_cardinals.append(c.SOUTH)
    if (column < (len(map_grid) - 1)):
        valid_cardinals.append(c.EAST)
    if diaganol:
        if ((row > 0) and (column > 0)):
            valid_cardinals.append(c.NORTHWEST)
        if ((row > 0) and (column < (len(map_grid) - 1))):
            valid_cardinals.append(c.NORTHEAST)
        if ((row < (len(map_grid) - 1)) and (column > 0)):
            valid_cardinals.append(c.SOUTHWEST)
        if ((row < (len(map_grid) - 1)) and (column < (len(map_grid) - 1))):
            valid_cardinals.append(c.SOUTHEAST)
    return valid_cardinals