Imagine being swept away by a river of pure energy! That’s exactly what happens to Ethic and Hedge as they fall from a tower and land in this powerful stream. This river flows from the Bradbarrier all the way to Huxenborg, a city bustling with factories that build robots. Hidden within this city is the Node of Memory, the last of three powerful artifacts Ethic needs to find.
After a long journey, Ethic and Hedge find themselves in a canyon made of brick and steel. Just when things seem hopeless, a rope catches them, and they meet their savior, Lemma. Lemma is a brilliant scientist working from inside Huxenborg to help bring down the machines.
When Ethic found the Node of Creation earlier, it caused radios everywhere to come back to life. This allowed Adila, the resistance leader, to contact her allies, including Lemma. However, the radios also alerted the robots, who are now on high alert to protect the final artifact in the city.
To reach the Node of Memory, Ethic and Hedge must navigate a dangerous maze called the gauntlet of forking paths. This maze is a series of glowing conveyors that twist and turn beneath Huxenborg. Each section of the path splits into two, and this pattern repeats thousands of times. Only one path leads to the artifact; the others lead to destruction.
Luckily, the Node of Creation has given Hedge a unique ability: he can create smaller versions of himself. Each version can do two things: send information back to its parent and create even smaller versions of itself. This ability is crucial because a patrol is closing in, and Ethic needs to act fast.
To solve this problem, Ethic can use a programming concept called recursion. Recursion is when a set of instructions refers back to itself. It’s like a loop, but instead of repeating the same action, it calls itself until a specific condition is met. This is perfect for problems that involve repeating patterns, like the maze Ethic and Hedge face.
At first glance, the maze seems complex, but recursion offers a simple solution. Imagine if the maze had only two paths. Hedge could create a copy of himself to explore each path. The copy that finds the artifact will send the correct path back to its parent. This is known as the “base case” in recursion.
Now, if the maze branches multiple times, Hedge’s copies (let’s call them Twig 1 and Twig 2) will create more copies (Leaves 1 through 4). Most will be destroyed, but the one that reaches the artifact will relay the correct path back. Each copy will tell its parent which way it went and the path it heard over the radio.
To navigate the maze, Hedge uses a set of instructions called Pathfinder:
This process allows Hedge to map the entire network of paths using just these three instructions. By the time the patrol arrives, Ethic and Lemma have disguised themselves to buy Hedge some time. Finally, Hedge’s radio crackles with the correct directions, and they escape on the conveyor, pursued by enforcer bots.
Through clever thinking and the power of recursion, Ethic and Hedge are one step closer to their goal!
“`html
Design a simple maze on paper or using a digital tool. Your task is to use the concept of recursion to find the shortest path through the maze. Create a flowchart that outlines the recursive steps you would take to solve the maze, similar to how Hedge uses his copies to explore paths.
Illustrate a storyboard that captures the key moments of Ethic and Hedge’s adventure in the gauntlet of forking paths. Focus on how recursion plays a role in their journey. Share your storyboard with the class and explain how each scene demonstrates the use of recursion.
Using a programming language of your choice, write a simple recursive function that mimics Hedge’s Pathfinder instructions. Test your function with different scenarios to see how it handles various branching paths. Share your code and results with your classmates.
In groups, role-play the scenario where Ethic and Hedge navigate the gauntlet. Assign roles such as Ethic, Hedge, and the patrol. Use props to represent the maze and practice using recursion to find the correct path. Reflect on how this exercise helps you understand recursion better.
Engage in a class discussion about the advantages and challenges of using recursion in problem-solving. Consider how Ethic and Hedge’s use of recursion helped them succeed. Share your thoughts on other real-world problems where recursion could be applied effectively.
“`
Here’s a sanitized version of the provided YouTube transcript:
—
Their fall from the tower sends Ethic and Hedgespinning into the rapids of a river of pure energy. This torrent flows from the Bradbarrier all the way to Huxenborg. There, an entire city’s worth of factories builds the robots and houses the Node of Memory, the last of the three powerful artifacts Ethic needs to collect. After a long day and a longer night, they find themselves in a canyon of brick and steel. Just when they’re about to reach the end of the line, a rope catches them. Their savior, Lemma, has been waiting for them.
When Ethic claimed the Node of Creation from the forest tower, radios all across the land came back to life. Adila, the resistance leader, immediately started contacting her allies, none more important than Lemma, a brilliant scientist working from within Huxenborg to bring down the machines. Unfortunately, the radios also alerted the robots, prompting them to take defensive measures to protect the final artifact in the heart of the city.
There’s only one way to get there: the gauntlet of forking paths. It’s a deadly series of luminous conveyors that wind underneath Huxenborg. Starting from their current position, each section runs for a distance, then splits in two. Every branch does the same thing, again and again. There are thousands of branches. Only one path leads to the artifact; all the others lead to destruction.
Fortunately, the Node of Creation has granted Hedge a strange power: he can produce slightly smaller versions of himself. Each version can do only two things: relay information back to its parent and produce slightly smaller versions of itself, which can do the same two things, and so on for as many generations as needed. A patrol is closing in on their position, so Ethic’s time is limited. What instructions should she give Hedge to find the one safe path?
Pause the video to figure it out yourself.
Hint in 3… Hint in 2… Hint in 1…
Programmers have an elegant tool in their arsenal called recursion. Recursion is when you have a set of instructions that refers back to itself. It’s like using a word in its own definition; however, this is incredibly effective. Recursion involves repetition, but in a different way than loops. While a loop takes one action and repeats it, recursion starts an action and, before it’s finished, uses it again, and so on, until an end state is reached. It then passes the information back up, layer after layer, until it reaches the top and ends the cycle.
Recursion is ideal for problems that involve self-similarity, where each part resembles the larger whole, like a defense system designed to eliminate any person or thing that dares tread upon it.
Pause the video to figure it out yourself.
Solution in 3… Solution in 2… Solution in 1…
Ethic’s conundrum seems sprawling on the surface, but there’s a remarkably simple solution using recursion. To find it, let’s first look at the simplest version of this puzzle: what if the entire maze were just two paths? If Hedge copies himself, the copy that goes the wrong way will be destroyed. The other one, which reaches the artifact, can relay back the path it took, and no matter which way is correct, that’s the answer Hedge will receive. This is called the “base case” of the recursion.
Now, suppose the maze branches twice from the starting point, and at every intersection, Hedge’s copies—let’s call them Twig 1 and Twig 2—make more copies—let’s call them Leaves 1 through 4. Three Leaves will be destroyed. The one that reaches the artifact will relay back the right answer, but only to its parent. So if Twig 1 or 2 is waiting at an intersection and hears something over the radio, that’s the right way to go to the artifact from where it is. To tell Hedge the right answer from his perspective, the Twig should say which way it went, and then the route it just heard over the radio.
This same process will work no matter how many times the maze branches. Any answer a copy hears on the radio must be the way to the control room from its location, and if it then adds the branch it took, it can tell its parent how to get there as well. We can sum up the instructions in an action called Pathfinder that every version of Hedge will follow:
1. If you’ve reached the artifact, relay to your parent whether you got there by going left or right.
2. When you reach an intersection, move off the conveyor and send new copies down the left and right paths. Have them each run Pathfinder. This is where recursion comes in, and this may happen many times before the last instruction triggers, which is:
3. If you hear anything over the radio, you should relay to your parent whether you got to your spot by going left or right, then repeat everything you just heard.
Pathfinder is an example of what programmers call functions, subroutines, or procedures. No matter the terminology, the idea is the same—it’s a set of instructions given a label so that it can be easily reused—perhaps even by itself. And in our case, that’ll work perfectly—an entire network of paths mapped using just three instructions.
So here’s what happens. By the time the patrol rounds the corner, Ethic and Lemma have improvised disguises. They try to confuse the bots long enough to buy Hedge time. Finally, Hedge’s radio crackles to life with a series of directions. The three dive onto the conveyor and flee for their lives, with a squadron of enforcer bots in hot pursuit.
—
This version maintains the essence of the original transcript while removing any potentially sensitive or inappropriate content.
Energy – The power required to perform tasks on a computer, often related to the processing capability and efficiency of hardware components. – Modern processors are designed to use less energy while maintaining high performance levels.
Robots – Automated machines that can be programmed to perform specific tasks, often used in manufacturing and coding experiments. – In our coding class, we programmed robots to navigate through a simple obstacle course.
Memory – The component of a computer that stores data and instructions for processing, including both temporary and permanent storage. – Upgrading the computer’s memory can significantly improve its performance when running multiple applications.
Recursion – A programming technique where a function calls itself in order to solve a problem, often used for tasks like sorting and searching. – We used recursion in our code to efficiently solve the problem of finding the factorial of a number.
Maze – A complex network of paths or passages, often used in computer science to test algorithms for finding the shortest route. – The coding challenge involved writing an algorithm to help a virtual character escape from a digital maze.
Pathfinder – A software or algorithm designed to find the best path or route, often used in navigation and gaming applications. – The pathfinder algorithm helped the game character navigate through the virtual world efficiently.
Creation – The process of designing and building new software, applications, or digital content using programming languages and tools. – Our project focused on the creation of a mobile app that helps students organize their study schedules.
Instructions – Commands or directives given to a computer program to perform specific operations or tasks. – The program executed the instructions flawlessly, resulting in a successful data analysis.
Alert – A notification or message that informs users of important information or changes in a computer system or application. – The system sent an alert to notify the user about the low battery level of the device.
Factories – In programming, a design pattern used to create objects, often used to manage and simplify the creation of complex objects. – We implemented factories in our code to streamline the creation of different types of game characters.