def find_escape_floor(pac_mine, pac_their, scene):
    """
    Find an escape floor which will save our pac from being eaten.
    """

    # Shortcuts
    escapes = scene['escape']
    my_x = pac_mine['position'][0]
    my_y = pac_mine['position'][1]
    their_x = pac_their['position'][0]
    their_y = pac_their['position'][1]

    # Identify the arrangement of the pacs to select the correct escape floor.
    dx = abs(my_x - their_x)
    dy = abs(my_y - their_y)

    # The x is prefered because the width is greater than the height.
    if dx >= dy:
        # Horizontal or diagonal with equal distance on x and y.
        if my_x > their_x:
            return escapes['right']
        else:
            return escapes['left']
    else:
        # Vertical.
        if my_y > their_y:
            return escapes['down']
        else:
            return escapes['up']