ribolands/pathfinder.py
def findpath_merge(outside, inside, i, j):
    """ Merge two composable findpath runs.

    This is a simplified variant which just appends the two runs ...
    """
    starten = outside[0][1] + inside[0][1]
    bh1 = bh2 = 0

    path1 = []
    stepI, enI = inside[0]
    for stepO, enO in outside:
        merged = merge_struct(stepO, stepI, i, j)
        energy = enO + enI - starten
        path1.append((merged, energy))
        bh1 = max(bh1, energy)
    stepO, enO = outside[-1]
    for stepI, enI in inside[1:]:
        merged = merge_struct(stepO, stepI, i, j)
        energy = enO + enI - starten
        path1.append((merged, energy))
        bh1 = max(bh1, energy)

    path2 = []
    stepO, enO = outside[0]
    for stepI, enI in inside:
        merged = merge_struct(stepO, stepI, i, j)
        energy = enO + enI - starten
        path2.append((merged, energy))
        bh2 = max(bh2, energy)
    stepI, enI = inside[-1]
    for stepO, enO in outside[1:]:
        merged = merge_struct(stepO, stepI, i, j)
        energy = enO + enI - starten
        bh2 = max(bh2, energy)
        path2.append((merged, energy))
    return (path1, bh1) if bh1 < bh2 else (path2, bh2)
 Merge two composable findpath runs.

    This is a simplified variant which just appends the two runs ...
    
Merge two composable findpath runs.
This is a simplified variant which just appends the two runs
Merge two composable findpath runs . This is a simplified variant which just appends the two runs
def findpath_merge(outside, inside, i, j):
    starten = outside[0][1] + inside[0][1]
    bh1 = bh2 = 0
    path1 = []
    stepI, enI = inside[0]
    for stepO, enO in outside:
        merged = merge_struct(stepO, stepI, i, j)
        energy = enO + enI - starten
        path1.append((merged, energy))
        bh1 = max(bh1, energy)
    stepO, enO = outside[-1]
    for stepI, enI in inside[1:]:
        merged = merge_struct(stepO, stepI, i, j)
        energy = enO + enI - starten
        path1.append((merged, energy))
        bh1 = max(bh1, energy)
    path2 = []
    stepO, enO = outside[0]
    for stepI, enI in inside:
        merged = merge_struct(stepO, stepI, i, j)
        energy = enO + enI - starten
        path2.append((merged, energy))
        bh2 = max(bh2, energy)
    stepI, enI = inside[-1]
    for stepO, enO in outside[1:]:
        merged = merge_struct(stepO, stepI, i, j)
        energy = enO + enI - starten
        bh2 = max(bh2, energy)
        path2.append((merged, energy))
    return (path1, bh1) if bh1 < bh2 else (path2, bh2)
def findpath_merge ( outside , inside , i , j ) : starten = outside [ 0 ] [ 1 ] + inside [ 0 ] [ 1 ] bh1 = bh2 = 0 path1 = [ ] stepI , enI = inside [ 0 ] for stepO , enO in outside : merged = merge_struct ( stepO , stepI , i , j ) energy = enO + enI - starten path1 . append ( ( merged , energy ) ) bh1 = max ( bh1 , energy ) stepO , enO = outside [ - 1 ] for stepI , enI in inside [ 1 : ] : merged = merge_struct ( stepO , stepI , i , j ) energy = enO + enI - starten path1 . append ( ( merged , energy ) ) bh1 = max ( bh1 , energy ) path2 = [ ] stepO , enO = outside [ 0 ] for stepI , enI in inside : merged = merge_struct ( stepO , stepI , i , j ) energy = enO + enI - starten path2 . append ( ( merged , energy ) ) bh2 = max ( bh2 , energy ) stepI , enI = inside [ - 1 ] for stepO , enO in outside [ 1 : ] : merged = merge_struct ( stepO , stepI , i , j ) energy = enO + enI - starten bh2 = max ( bh2 , energy ) path2 . append ( ( merged , energy ) ) return ( path1 , bh1 ) if bh1 < bh2 else ( path2 , bh2 )
Merge two composable findpath runs.
Merge two composable findpath runs .
""" Merge two composable findpath runs.

    This is a simplified variant which just appends the two runs ...
    """
outside
inside
i
j