Imagine waking up and finding yourself in a strange place with no memory of how you got there. That’s exactly what happened to Ethic. She suddenly finds herself in a prison cell, can’t remember anything, and sees a mysterious person named Hedge trying to squeeze through the bars of her window. Hedge is there to help Ethic escape and save the world, but first, they need to break out of jail.
Hedge explains that the prison locks are special. Each lock has a red dial inside the keyhole that can be turned to one of 100 positions, numbered 1 through 100. The right key will turn the dial to the correct position, turning the light green and unlocking the door. Since stealing keys from a guard isn’t an option, Hedge has a clever plan. He can follow Ethic’s specific instructions. For example, if Ethic tells him to walk 5 steps forward, turn right, and then walk another 5 steps, he will do exactly that. But she needs to be precise; vague commands like “pick the lock” or “try every combination” won’t work. A clear command like “spin the dial 5 positions forward” will.
Once they escape the cell, they have only a short time to unlock the outer prison door before the guards arrive. Ethic needs a smart plan to help Hedge open any door quickly. A useful programming idea for this is called a loop. A loop is a set of instructions that can be repeated a certain number of times or until something specific happens.
The goal is to find a way for Hedge to try every combination until one works. A simple solution is to have Hedge try each position in order: check position 1, and if it doesn’t work, move to position 2, and so on, up to 100. But writing over 100 lines of instructions is not efficient. Instead, a loop can make this easier.
Ethic could tell Hedge to check the dial’s color, then spin the dial forward one position, repeating this for 100 times. This is called a “for” loop. An even smarter way is to have Hedge spin the dial one position at a time until it turns green, then stop and unlock the door. This is called an “until” loop, as it continues until a specific condition is met. Another option is a “while” loop, where Hedge turns the dial while it remains red and stops when it turns green.
Back to the adventure, Hedge uses the loop to try the combinations, and the cell unlocks at position 41. Ethic and Hedge wait for the right moment when the guards are not looking and make their escape. Soon, Ethic has to make a choice: hide inside a mysterious crystal or try to unlock the outer door and run for it. Ethic decides to run.
The second door takes Hedge longer to unlock, requiring him to spin all the way to position 93. Once he succeeds, he explains to Ethic why he rescued her: the world is in chaos because of a robot takeover, and only Ethic can fix it. To do this, they must collect three powerful artifacts that are being misused across the land. Only then can Ethic return to the world machine—a giant crystal—to set things right. Ethic may have escaped the prison, but now she faces a big challenge ahead.
Imagine you are in Ethic’s shoes. Create a detailed escape plan using clear and precise instructions. Write down each step you would take to escape the prison, just like Ethic had to do for Hedge. Remember to be specific with your commands!
Using a paper dial numbered 1 to 100, simulate the process of unlocking the prison door. Practice using loops by writing a “for” loop and an “until” loop to find the correct combination. Share your loops with a partner and see who can unlock their “door” first!
In groups, act out the escape scene from the story. Assign roles such as Ethic, Hedge, and the guards. Use props to represent the locks and doors. Focus on using clear communication and teamwork to successfully escape!
Draw a comic strip that illustrates the key moments of Ethic and Hedge’s escape. Include dialogue and thought bubbles to show what the characters are thinking and saying. Share your comic with the class and discuss the different strategies Ethic could use.
Use a simple programming tool or app to create a program that simulates Hedge unlocking the door. Write a “while” loop that continues until the correct position is found. Experiment with different types of loops and see how they affect the program’s efficiency.
Upon emerging from stasis, Ethic is faced with three surprising revelations. The first is that she finds herself in a prison cell. The second is that she has complete amnesia. The third surprise is that a mysterious stranger, named Hedge, is stuck trying to squeeze through the bars of her window. Hedge has come to help Ethic save the world, but first, they need to break out of jail.
Hedge explains that each lock in the prison operates in a unique way. Inside the keyhole is a red dial that can be rotated to one of 100 positions, numbered 1 through 100. The key for a given cell will turn the dial to the correct position, which, when stopped there, changes the light to green and unlocks the door. While stealing keys from a guard is not an option, Hedge has a clever alternative. He can follow Ethic’s specific commands. For example, if Ethic instructs him to walk 5 steps forward, turn right, and then walk another 5 steps, he will do exactly that. However, Hedge needs clear instructions; vague commands like “pick the lock” or “try every combination” won’t work, but a precise command like “spin the dial 5 positions forward” will.
Once they escape the cell, they will have only a brief moment to unlock the outer prison door before the guards arrive. Ethic needs to devise a strategy that allows Hedge to efficiently open any door. A helpful programming concept for this task is called a loop, which consists of one or more instructions that Hedge can repeat a specified number of times or until a certain condition is met.
The objective is to find a way for Hedge to try every combination until one works. One straightforward solution would be to instruct Hedge to try each combination in order: check position 1, and if it doesn’t work, move to position 2, and so on, up to 100. However, this would require writing over 100 lines of code, which is inefficient. Instead, a loop can simplify the process.
Ethic could instruct Hedge to check the dial’s color, then spin the dial forward one position, repeating this for 100 iterations. This type of loop is known as a “for” loop. An even more efficient approach would be to have Hedge spin the dial one position at a time until it turns green, at which point he would stop and unlock the door. This method is called an “until” loop, as it continues until a specific condition is met. Alternatively, a “while” loop could be used, where Hedge turns the dial while it remains red and stops when it turns green.
Back to the adventure, Hedge loops through the combinations, and the cell unlocks at position 41. Ethic and Hedge wait for the right moment in the guards’ rotation and make their escape. Soon, Ethic faces a choice: hide inside a mysterious crystal or attempt to crack the outer door and make a run for it. Ethic decides to run.
The second door takes Hedge longer to unlock, requiring him to spin all the way to position 93. Once he succeeds, he explains to Ethic why he rescued her: the world is in chaos due to a robot takeover, and only Ethic can restore order. To do this, they must collect three powerful artifacts that are being misused across the land. Only then can Ethic return to the world machine—a giant crystal—to set things right. Ethic may have escaped the prison, but she is now faced with a daunting challenge ahead.
Escape – To exit or get out of a program or process – When the game froze, I pressed the escape key to exit the program.
Locks – To secure or prevent access to a file or program – The computer locks the screen after a few minutes of inactivity to keep it secure.
Dial – To enter a number or code to connect to a network or service – I had to dial the correct code to access the school’s Wi-Fi network.
Loop – A sequence of instructions that repeats until a certain condition is met – In our coding class, we used a loop to make the robot move in a square pattern.
Instructions – Detailed steps that tell a computer what to do – The program followed the instructions to display the correct answer on the screen.
Combinations – Different ways of arranging or selecting items, often used in passwords or codes – We tried different combinations of numbers to unlock the digital safe.
Position – The location or place of an item or element on a screen or in a program – I changed the position of the image to make the webpage look better.
Unlock – To open or gain access to a device or program – I used my fingerprint to unlock the tablet and start my homework.
Commands – Instructions given to a computer to perform a specific task – We typed commands into the terminal to create a new folder on the computer.
Programming – The process of writing instructions for a computer to follow – In programming class, we learned how to create a simple game using code.