In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of January 4th
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #11 exercise sheet]


In this problem you should submit a function as described. Inside the function do not print anything that was not asked!

[IP100] Trinity's Escape

The sound of gunfire echoes through the hallway as Trinity sprints, her boots clattering on the floor. An Agent is hot on her heels.

"Operator, I need an exit! Find me a booth, Tank, NOW!" she shouts.

Tank's voice crackles back. "I'm trying, Trinity, but most of the connections are offline. Something’s wrong... booths are disappearing from the matrix!"

Suddenly, Neo's voice interrupts. "Tank, I'm going in. We need to confirm that these booths actually exist before sending Trinity in. Someone is introducing these bugs on purpose."

The Problem

Write a function find_exit(connections, check_booth, seed) that given a dictionary connections, randomly deletes some booths and checks whether a given booth check_booth still exists. In case the booth exists, the respective instructions should be returned. In case the booth has been deleted, an alert message should be returned instead: "Compromised booth! Aborting connection.".

Consider the following:

Use the following connections in your code to test:
    connections = {
    "B1": "Go to the red door in the hallway and turn left.",
    "B2": "Head over to the back alley and find the hidden key.",
    "B3": "Find the elevator and press the secret button.",
    "B4": "Turn left at the second street and look for the green sign.",
    "B5": "Follow the alley until you see a blue dumpster, then turn right.",
    "B6": "Look for a door with a glowing symbol and open it.",
    "B7": "Enter the subway station, go down the stairs, and find the secret passage.",
    "B8": "Turn around and go through the abandoned building entrance.",
    "B9": "Find the underground tunnel entrance near the library.",
    "B1O": "Go straight ahead, take the first right, and find the hidden hatch."
    }
For instance, using the above dictionary connections and a seed = 42, only the following booths will remain:
['B1', 'B5', 'B6', 'B7', 'B9']
This means that:

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

connections       The available connections to booths as shown above
-1000 ≤ seed ≤ 1000       The seed to randomly generate missing booths
check_booth \( \in \{B_1, \cdots, B_{1O}\} \)       The booths to check in the dictionary

Example Function Calls Example Output
print(find_exit(connections, "B1", 42))
print(find_exit(connections, "B4", 42))
print(find_exit(connections, "B9", 123))
Go to the red door in the hallway and turn left.
Compromised booth! Aborting connection.
Find the underground tunnel entrance near the library.

Introduction to Programming (CC1024)
DCC/FCUP - University of Porto