The Tower of Epiphany | Think Like A Coder, Ep 7

Alphabets Sounds Video

share us on:

In “The Tower of Epiphany: Think Like A Coder, Episode 7,” Ethic and her robot friend Hedge face the challenge of ascending a towering structure by solving an energy puzzle. They must determine the amount of energy each column can hold using an efficient algorithm that involves tracking the tallest stacks of blocks on both sides of each column. As they successfully navigate the energy barriers and reach the Node of Creation, Ethic reflects on her past and the creation of artifacts meant to restore people’s power, setting the stage for further developments in their journey.

The Tower of Epiphany: Think Like A Coder, Episode 7

Ethic and her robot friend, Hedge, find themselves at the base of a gigantic tower. Their mission is to reach the Node of Creation, but energy barriers block their way. To get past these barriers, Ethic needs to use three energy streams to climb the tower. As soon as she steps forward, a 60-second timer starts ticking down.

The Energy Challenge

At the back of the room, there’s a special basin made of invisible towers that can hold energy. After one minute, energy will start pouring down, filling the basin one unit at a time. Ethic and Hedge have to figure out exactly how many units of energy will fill the basin perfectly. If they guess right, the energy will lift them higher up the tower. If they guess wrong, the lift will fail, and they’ll drop back down.

Understanding the Energy Puzzle

Hedge can make one tower of blocks visible at a time and count its height, but he can’t see the whole structure at once. Ethic needs to program Hedge to figure out how much energy each basin can hold. Here’s a way to think about it: energy will fill a space if there’s a wall to its left and right. But checking each space individually would take too long. Instead, Hedge can look at a whole column of blocks at once.

Analyzing the Problem

Let’s look at an example with 5 columns of blocks. The first column can’t hold any energy because there’s nothing taller than it. The second column can hold 3 units of energy, trapped between two taller columns. We calculate this by taking the height where the energy would level off (4) and subtracting the height of the column (1). The third column is similar, holding 1 unit of energy. The fourth and fifth columns can’t hold any energy because there’s nothing taller to their right.

Creating an Algorithm

We can turn this idea into a step-by-step process. For each column, Hedge can look left to find the tallest stack and right to find the tallest stack. The smaller of these two heights is the maximum height the energy can fill. If this height is greater than the column’s height, subtract the column’s height to find how much energy it can hold. If it’s equal or less, the energy will spill over.

Hedge can apply this method to the entire basin by moving from the leftmost column to the right, repeating the steps for each column. This will work, but it might take a long time for a large basin.

Speeding Up the Process

To make things faster, Hedge can first go from left to right, keeping track of the tallest stack seen so far. Then, he can do the same from right to left. With this information, Hedge can quickly calculate the energy above each column using the same method as before. This way, instead of checking each stack multiple times, Hedge only needs to check each stack three times, which is much faster.

The Final Challenge

With this efficient method, Ethic and Hedge work together seamlessly. The first energy cascade is easy, and they rise up the tower. The second is a bit harder, and the third is massive, with many stacks of blocks. As the timer counts down, Ethic’s program works quickly, and they reach the Node of Creation just in time.

At the Node of Creation, Ethic sees a vision of the past. She remembers how the world machine changed everything and how she, as a chief robotics engineer, became worried. When barriers were put up to trap people, she knew something was wrong. Ethic created three artifacts to restore people’s power, creativity, and memory, and hid them in different communities. Before she could explain how to use them, the government tried to stop her. The last thing she did was create Hedge to protect the ancient device from ignorance.

Suddenly, the energy lift flickers and stops. What will happen next? Stay tuned to find out!

  1. How did Ethic’s approach to solving the energy puzzle reflect her problem-solving skills and adaptability? Can you relate this to a personal experience where you had to adapt your strategy to overcome a challenge?
  2. What do you think the energy barriers symbolize in the story, and how do they relate to obstacles you face in your own life?
  3. Reflect on the teamwork between Ethic and Hedge. How important is collaboration in solving complex problems, and how have you experienced this in your own projects or work?
  4. Consider the algorithm Ethic and Hedge developed to solve the energy puzzle. How does this process of breaking down a problem into smaller steps apply to your own decision-making or problem-solving techniques?
  5. The story mentions Ethic’s vision of the past and her role as a chief robotics engineer. How does understanding one’s past influence their present actions and decisions? Can you think of a time when your past experiences shaped your current choices?
  6. Ethic created artifacts to restore power, creativity, and memory. How do you interpret the significance of these three elements, and how do they play a role in your personal or professional life?
  7. What lessons can be learned from Ethic’s foresight in creating Hedge to protect the ancient device? How do you prepare for future uncertainties in your own life?
  8. The story ends with a cliffhanger as the energy lift flickers and stops. How do you deal with unexpected interruptions or setbacks in your plans, and what strategies do you use to stay motivated?
  1. Energy Basin Simulation

    Imagine you’re Ethic and Hedge, and create a physical model of the energy basin using blocks or cups. Use water or small objects to simulate energy units. Try to predict how much energy each section can hold before testing it out. Discuss with your classmates why some sections hold more energy than others.

  2. Algorithm Design Challenge

    Work in pairs to design an algorithm that Ethic could use to calculate the energy each column can hold. Write down your steps and test them with different block configurations. Share your algorithm with the class and compare different approaches.

  3. Code a Solution

    Using a simple programming language like Python, code the algorithm you designed. Test your code with various inputs to ensure it works correctly. If you encounter any issues, troubleshoot and refine your code. Share your successful code with the class.

  4. Energy Puzzle Game

    Create a board game based on the energy puzzle. Design a game board with columns of varying heights and use tokens to represent energy units. Players take turns calculating how much energy each column can hold, and the player who fills the most columns correctly wins.

  5. Story Continuation

    Write a short story about what happens next after Ethic and Hedge reach the Node of Creation. Use your imagination to describe how they solve the next challenge and what new adventures await them. Share your story with the class and discuss different possible outcomes.

Ethic and Hedge are on the ground floor of a massive tower. Barriers of energy separate them from their quest’s second goal: the Node of Creation. To reach it, Ethic must use three energy streams to climb the tower. As soon as she steps forward, a timer will begin counting down from 60 seconds. At the back of the room, there’s a basin made of invisible towers that can hold energy between them. After one minute, a torrent of energy will pour down from above, filling one unit at a time, with a force field preventing it from spilling out the front or back. During the 60 calm seconds, Ethic and Hedge must decide exactly how many units of energy will fall. For each of the three challenges, they must choose the amount that will fill the basin exactly. If they do so, the energy will propel them further upwards. But if they get the amount wrong, the energy lift will fail, dropping them. Diagrams on the walls illustrate some examples.

Hedge can make one tower of blocks visible at a time and count how tall it is, but he can’t look at the whole structure all at once. How does Ethic program Hedge to figure out exactly how much energy each basin can hold?

Here’s one way of thinking about what’s happening: each unoccupied cell will hold energy if and only if there is a wall eventually to its left and a wall eventually to its right. But it would take a long time for Hedge to check this for each individual cell. So what if he were to consider a whole column of blocks at a time?

Let’s analyze the problem by looking at our example. There are 5 columns of blocks here. The leftmost one can’t hold any energy, because there’s nothing higher than it. The 2nd stack can have 3 units above it, as they would be trapped between these two 4-block stacks. We get 3 units by taking the height where the energy would level off—4—and subtracting the height of the stack—so that’s 4 minus 1. The 3rd stack is similar—4 to the left, 4 to the right, and it’s 3 high, so it’ll hold 4 minus 3 equals 1 unit. The 4th and 5th stacks have nothing higher than them to the right, so they can’t hold any energy.

We can adapt this idea into an algorithm. Considering one column at a time as the point of reference, Hedge can look to the left stack by stack to find the height of the tallest one, look to the right to find the height of the tallest one, and take the smaller of the two as the height the energy can fill up to. If the result is higher than the column in question, subtract the height of the original column, and the result will be the number of units that column can hold. If it’s equal to or below the level of the column in question, the energy would spill off.

Hedge can apply that to an entire basin with a loop that starts on the left-most column and moves right, one column at a time. For each column, he’ll run the same steps—look all the way left for the tallest, do the same to the right, take the lower height of the two, subtract the original column height, and increase the grand total if that number is positive. His loop will repeat as many times as there are columns. That will work, but it’ll take a long time for a large basin.

At every step, Hedge repeats the action of looking left and looking right. If there are N stacks, he’ll look at all N stacks N times. Is there a faster way?

Here’s one time saver: before doing anything else, Hedge can start on the left and keep a running tally of what the highest stack is. He can then find the highest right-most stacks by doing the same going right-to-left. In the end, he’ll have a table like this in his memory. Now, Hedge can take one more pass to calculate how much energy there will be above every stack with the same equation from before: take the smaller of the stored left and right values, and subtract the height of the current tower. Instead of looking at N stacks N times, he’ll look at N stacks just 3 times—which is what’s called linear time.

There are ways to optimize the solution even further, but this is good enough for our heroes. Ethic and Hedge work as one. The first cascade is a breeze, and they rise up the tower. The second is a little tougher. The third is huge, with dozens of stacks of blocks. The timer ticks down towards zero, but Ethic’s program is fast. She gets the wheel in position just in time, and the energy lifts them to the Node of Creation.

Like the first, it reveals a vision: memories of years gone by. The world machine changed everything, and Ethic, in her position as chief robotics engineer, grew troubled by what she saw. When the barrier went up to keep the people in, she knew something was seriously wrong. So she created three artifacts with the ability to restore people’s power, creativity, and memory, and smuggled them to three communities. Before she could tell people how to use them, the government discovered her efforts and sent bots to arrest her and the other programmers. The last thing Ethic used the world machine to create was a robot that would protect the ancient device from the forces of ignorance by enclosing it in a giant maze. She named her creation Hedge.

Without warning, the energy lift flickers, then fizzles out.

EnergyThe power required to run computers and other electronic devices. – The computer uses a lot of energy when running complex programs.

TowerA tall computer case that holds the main components of a desktop computer. – The new gaming computer has a sleek tower with colorful lights.

BlocksPieces of code that can be combined to create a program, often used in visual programming languages. – In Scratch, you can drag and drop blocks to make your character move.

HeightThe measurement of how tall something is, which can also refer to the size of a computer screen or window. – Adjust the height of the window to see the entire webpage.

AlgorithmA set of instructions designed to perform a specific task or solve a problem. – The search engine uses a complex algorithm to find the best results for your query.

ProcessA series of actions or steps taken to achieve a particular end in computing. – The computer needs to process the data before displaying the results.

ChallengeA task or problem in coding that requires effort and skill to solve. – Debugging the code was a challenge, but it helped me learn a lot.

ProgramA set of instructions that a computer follows to perform a task. – I wrote a program to calculate the average of my test scores.

CalculateTo determine a value or number using mathematical processes in a computer program. – The software can quickly calculate the total cost of all items in your shopping cart.

BasinA term not commonly used in computing, but can metaphorically refer to a collection point for data or resources. – The data basin stores all the information collected from the sensors.

All Video Lessons

Login your account

Please login your account to get started.

Don't have an account?

Register your account

Please sign up your account to get started.

Already have an account?