Exemplo n.º 1
0
def MakeSuccessor(x, y, gX, gY):
    if (x < 0 or x >= MAX_X() or y < 0 or y >= MAX_Y()):
        return None
    ele = elevations[x][y]
    ter = Terrain.GetTerrainVal(pix[x, y])
    if ter == Terrain.OutOfBounds():
        return None
    s = State.State(ele, ter, x, y, gX, gY)
    return s
Exemplo n.º 2
0
def make_neighbor(x, y):
    # validates out of bound indices
    if (x < 0 or x >= MAX_X() or y < 0 or y >= MAX_Y()):
        return None
    ter = Terrain.GetTerrainVal(pix[x, y])
    # filters out of bound neighbors
    if ter == Terrain.OutOfBounds():
        return None
    # must be a valid neighbor at this point
    return (x, y)