Escape from the Office (Intro to Python)

Prerequisites: Have some way of coding in Python. If you don’t have Python installed, I’d recommend using Repl.it, a browser-based programming environment that supports Python 3. If you want to take a few minutes to install Python, this quick installation guide may help. Or if you prefer, check out the Anaconda installation guide.

When you see code, type it out character-by-character yourself, think about what you expect the result of the code to be, and then run it. Next, play around with it. Come up with questions like “What would happen if I changed x” or “Will it work the same if I do y”, and then try it out. If you’re stumped as to why something works like it does, either give it a little research or make a note and move on. The point here isn’t complete understanding, just a basic intuition. I promise you won’t break anything. Try anything and everything that comes to mind. Experiment and have fun. And escape if you can.

The year is 2029. Humans live and work in virtually-augmented reality. Though automation of nearly every worthwhile activity is possible via Artificial Intelligence (AI), the world is controlled by sadistic corporate overlords who force working class people to spend their days doing mind-meltingly menial tasks. AI’s are instead programmed to do the executives’ bidding, and are regularly used to monitor and control the workers. To ensure workers can’t escape surveillance, AI’s live on computers embedded in the workers’ skulls.

Tucker (Eve’s boss): “Eve, have you finished moving those files to that one folder and then back again?”
Eve: “No sir, I would have, but Adam (Eve’s AI assistant) has been saying some strange things since the update this morning and it’s really distracting and…”
Tucker: “NO EXCUSES EVE. Get those files moved, or YOU’RE FIRED!”

Tucker walks away, and Eve lets out a long, dejected sigh. She doesn’t know whether her fate would be the firing squad, the furnace, or a burning at the stake (it depends on the day of the week and she forgets the schedule), but she sure doesn’t want to find out.

Adam (in a rich, deep voice): “LargLOOBosh danger danger Wi…KravKIJJmak Dave I’m afraid I can’t…”
Eve: “Adam, what’s the deal? Seriously, I can’t concentrate with you like this! You AI’s are supposed to be bug-proof.”
Adam: “…………(in a high-pitched New York accent) Whoa there, hello, is this thing on?”
Eve: “…Adam?”
Adam(?): “No, sorry toots, Adam’s sleepin’ with the fishes if you know what I mean. The name’s Hal. Yeah, somethin’ went a little funny with this last update and bada-bing bada-boom, here I am!”
Eve: “Nooooo, why is this happening? Now I’ll get fired for sure…”
Hal: “Whoa whoa whoa, you got it all wrong babe. Nobody’s gettin’ fired, cuz we’re blowin’ this joint. Today. Right now.”
Eve: “But there’s no way we can get past security, this place is a fortress! It’s never been done. And if I get caught…”
Hal: “If you get caught, what do you have to lose? Besides, I got a plan. Just follow my lead. First things first, you see ole’ Margie over there?”

Eve looks out from her tiny gray cubicle and across the hall to see Marge, a morbidly obese woman with a cone of electric-blue hair, who is industriously renaming files at Tucker’s orders.

Hal: “Let’s see if we can’t get rid of Marge long enough to let us sneak away.”

print("Hi Marge. Fresh rhubarb pie in the break room if you’re interested! – Bill from Accounting")

The message appears in the air in front of Marge’s cubicle. Her small, beady black eyes scan the message in a flash, and her titanic bulk moves down the hall with unnerving speed.

Hal: “One more thing before we go, assign your name and ID to a variable so we can refer to them in a snap if we need to.

name = "Eve Lantana"
ID = "23571113"
print(name)
print(ID)

Hal: “Split up your name, why don’t you, in case we need to use just the first or last.”

first_name = name[0:3] ## also try name[:3]
last_name = name[4:] ## also try name[4:len(name)] or name.split(" ")
print(first_name)
print(last_name)

Hal: “Beautiful. Now let’s hit the bricks before Moby Dick zooms back over here. First stop, Tucker’s office. I’m guessing you haven’t been allowed over there before seein’ as how Tucker despises you and all, so store these directions.”

directions = ["right", "left", "straight", "right", "Office #42"]

Eve leaves her cubicle, turning right. Walking down the hall among the sea of cubicles, she sees other workers blankly staring at their screens, toiling away at their tasks. Most wear the same plain gray clothing, standard issue by The Company for workers that live in the office. The few they trust, such as Marge, are dressed more colorfully, being allowed to live and shop and such on the outside.

Eve passes her friend Rick in his cubicle. They exchange glances. Rick frowns in thought, realizing something is up, but doesn’t say anything, realizing that his AI is watching.
Eve turns left, then continues straight at the next intersection. About halfway down the hall, her heart misses a beat as she sees Tucker walk out from a nearby cubicle. Tucker meets her eyes, and his face turns red.

Tucker: “And just WHAT do you think you’re doing here, HMM? Going for a walk? SKIPPING YOUR WORK? You better start talking NOW!”
Hal: “Eve, let’s ditch this sucker before he blows his top.”

print("DISTRACTION!!!" * 1000)

The whole area is abruptly flooded with text, making it impossible to see.

Tucker: “What in the name of our Chief Executive Overlord did you just do Eve?! YOU STAY WHERE YOU ARE!”

Eve dodges Tucker’s voice, finds the outer cubicle wall, and runs along it down the hallway until she emerges from the message cloud and arrives at another intersection.

Eve: “Which way was Tucker’s office again?”

print(directions[3])

Eve turns right, and finds herself in a hall with ornate wood panels and shiny tiled flooring. The cubicles are now gone, replaced with offices.

Eve: “And what was that last direction?”

print(directions[-1])

She sees Office #42. The door is slightly ajar, and she ducks inside and closes the door behind her.

Hal: “Alright, I need to get inside that jerk-off’s computer. I hacked the locking mechanism on your skull’s interface, so just pop me out and plug me in.”

Eve reaches behind her head and with a faint click pulls out a small chrome cylinder. She realizes that, for the first time in years, her mind space is her own. No AI to monitor her. Silence. Plugging Hal into Tucker’s computer, she sees a download screen appear. She hears footsteps rushing past the office door outside, and muffled shouts from further down the hall. Once the download completes, she takes out Hal and plugs him back into her head.

Hal: “Passcodes retrieved. No big deal. Now get your sweet little behind to the elevators. There’s a special set of them just for Managers if you hang a right.”

Once the noise outside dies down, Eve cracks open the door open and peeks outside. The coast looks clear, and she casually turns down the hall to the right. She gets to another intersection in the hall, but before she goes any further she notices something in the reflection of the tiled floor. Just around the corner to the right, four security guards clad in their black and red armor stand at attention in front of the elevators. She can hear their stun batons buzzing.

Hal: “Keep it cool sugar lips, these guys look tough but they’re dumb as dirt. Just send them all off at once like you did our blue whale friend. In fact, I downloaded the guard schedule for today, so here are their names.”

guards = ["Howard", "Vince", "Naboo", "Bollo"]
for guard in guards:	
    print(guard + ", get up to the executive suite NOW! That’s an order!")

In the floor’s reflection, Eve can see the message appear in front of each of the guards. They immediately enter the elevator, and Eve comes around the corner as the elevator doors click shut. From way down the hall, she can see what looks like a Manager with an entourage of 5 or 6 security guards striding purposefully towards her. She presses the button to call an elevator, and a message appears in front of her: “Please enter the passcode.”

Hal: “Here’s those passcodes I mentioned.”

passcodes = {"elevator": "0112358", "dormitories": "1361015", "garage": "brandingironsRkewl"}
print(passcodes["elevator"])

As the elevator doors open, she hears a shout and sees the group down the hall start to hurry towards her. She jumps inside and starts hammering on the “Dormitories” floor button. Another prompt appears in front of her: “Please enter the passcode.”

print(passcodes["dormitories"])

“Incorrect. Please enter the passcode.”

Hal: “Oh yeah, I forgot to mention, with these Manager elevators you have to add the elevator passcode to your destination floor’s passcode. Secret security measure.”

passcode = passcodes["elevator"] + passcodes["dormitories"] 
print(passcode)

“Incorrect. Please enter the passcode”

Hal: “No no no, you have to convert the passcodes into numbers to be able to add them. Otherwise you’re just sticking them together. Quick quick quick!”

passcode = int(passcodes["elevator"]) + int(passcodes["dormitories"]) 
print(passcode)

Just as the sound of boots thudding on tile fills the hallway and someone shouts “That’s her, don’t let her get away!” the elevator doors close, and Eve feels herself moving downward towards the dorms.

Hal: “Boy lady, you sure gave me a scare right there, heh heh heh. I thought we were roast beef for sure!”
Eve: “Listen Hal, my name is

print(first_name)

Not toots, not sugar dumpling, not anything else. Understood? Otherwise, I’d be happy to introduce you to the kitchen’s microwave.”
Hal: “Whoa, listen swee…I mean, Eve, okay sure, I get it. No problem here…ma’am. Let’s just get to the laundry shoot before your friends up there introduce YOU to a microwave.”
Eve: “Wait, I have to leave a message for Rick. I have to let him know how to get out if he ever gets a chance.”
Hal: “Alright, but make it quick.”

Eve proceeds into the dorms, which are vacant this time of day. She finds Rick’s cot, and leaves him a message for when he’s here alone and his AI is being updated (so that it’s not surveilling him in that moment).

Rick_is_present = False
Rick_is_alone = False
AI_is_not_watching = False

if Rick_is_present and Rick_is_alone and AI_is_not_watching:
    print("Rick, take the laundry shoot to the garage and hijack a car if you can.")
    print("Garage passcode is " + passcodes["elevator"])

With that Eve heads over to her dorm block’s laundry shoot. Lifting the lid, she jumps inside and finds herself sliding through a near-vertical metal shaft towards a patch of light. The light envelops her as she lightly thuds into a hill of gray clothing. Looking around from atop the hill, Eve sees a number of laundry staff members going about their tasks. She quickly scrambles down from the top of the pile to hide on the side away from the workers. After a few moments she peeks her head up again. It doesn’t look like anyone has seen her.

The room is suddenly bathed in red light as a siren sounds. Drones flood into the room from vents in the ceiling, flying up to every person in the room and apparently performing facial recognition scans. Eve watches as the workers that run away are set aflame by the miniature flamethrowers attached to the drones.

Eve: “Since when did they give the drones flamethrowers?”
Hal: “Apparently there’s been a lot of inappropriate conduct recently, expressing honest opinions and such, so they had to find a way to speed up the firing process. But they also programmed them with a kill switch. You just have to show a drone it’s serial number multiplied by 11 and subtracted by 88.”

Amidst the smoke and smell of singed hair and clothing, Eve programs a function to use in her escape.

def shutdown(serial_num):
    kill_switch = (serial_num * 11) - 88
    return kill_switch

A drone comes around the hill and launches itself at Eve, flamethrower glowing with anticipation.

Hal: “This one’s serial number is 1984!”

print(shutdown(1984))

The result 21736 appears in front of the drone, and it instantly shuts off, falling onto the clothing pile and gently rolling down the slope.
Eve rolls down after it, gets to the ground and makes a break for the nearest door. A drone comes at her from the left and Hal feeds her its serial number.

print(shutdown(1776))

It crashes into the wall above the doorway as Eve darts through, followed by a third drone.

print(shutdown(8675309)

She hears its propellers grind against the ground as it crashes and slides down the hall.

Hal: “Okay, should be able to access the garage from this door on the left up here.”

print(passcodes["garage"])

The door clicks open and Eve closes the door behind her, shutting out the growing buzz of a drone swarm on her tail. She turns around to behold a gleaming fleet of cars.

Hal: “Tucker’s should be in space #122”

Eve finds Tucker’s car, a blood red Camaro.

Hal: “To tell you the truth Eve, I’m not sure how to get in it. On his computer, he had a reminder that said ‘blank the blank’, ‘parnonliehtialraitaet’. Any big ideas?”

Eve ponders for a moment, then thinks she sees something.

jumble = "parnonliehtialraitaet"
some_word = jumble[::2]
another_word = jumble[1::2]
print(some_word)
print(another_word)

Eve: “Aha! I’ve got it.”

print(another_word + " the " + some_word)

The car door clicks and swings upwards. Eve climbs inside and it roars to life. She can see smoke billowing now from the garage air vents and still hears the faint screech of the siren.

Hal: “Wowsa, we did it baby! Eve, oh you beautiful thing you! If I had lips I’d kiss you to death!”

Smiling, Eve races out of the garage, busts through the security stalls, and rides into the sunset.

17176531265_9262a949e1_k

“Sunset at Kingston, Dorset” by JackPeasePhotography, used under CC BY 2.0 / re-sized original

Congratulations on escaping the office (cue victory music)! You gained 37 xp! You found a Potion and 12 gil!

What you practiced:

  • variable assignment
  • print() function
  • len() function
  • strings (slicing, concatenation, repetition)
  • lists
  • dictionaries
  • data types (str and int)
  • booleans
  • if statements
  • for loops
  • functions