The Furnace Bots | Think Like A Coder, Ep 3

The Furnace Bots | Think Like A Coder, Ep 3

Ethic and her robot Hedge agree to
help the resistance leader, Adila, sabotage the art-incinerating
furnace-bots. In exchange, Adila promises to lead them to the
first object of Ethic’s quest, an artifact called the Node of Power. Years ago, there was just
one furnace-bot. It had a 0 inside its furnace and an
unknown, randomly generated serial number. Over time, the original self-replicated
to produce more identical furnace-bots. Each child inherited the original’s
unknown serial number within its furnace, and had a random, unique serial
number of its own inscribed on its shell. The second generation of furnance-
bots also self-replicated in the same way, always passing their own serial
numbers to their offspring’s furnaces. This continued on for many generations. Today, each furnace-bot receives its
orders from its parent. So if Ethic can find the original zero bot
and somehow change its instructions, she could take over the
entire army, all at once. Adila has the perfect solution: a data crystal that she’s
been carrying for years, waiting for the right moment
to activate it. It contains a program designed
to gain control of a bot and give it new instructions. But if it’s uploaded to any furnace-
bot other than the original, the zero bot will override
the instructions and destroy the data crystal
in the process. The feeding is just a
few minutes away, and there’s only one
chance to get this right. Fortunately, Hedge’s ability to
store data can help. In programming, a piece of information gets
stored in something called a variable. Variables are basically containers that
hold onto numbers, words, or other values. How does Ethic program Hedge to find the
original zero bot as quickly as possible? Pause now to figure it out for yourself. Here’s a hint. Programs can be written to have as
many variables as you need, but you can solve this problem
with just one. Hedge can use it to store
a serial number and replace it with a new one
as often as he needs. Pause now to figure it out for yourself. A key insight here is that Hedge
doesn’t need to map out the entire set of relationships to find the
original furnace-bot. If, for example, he gets lucky and picks
the original one right away, he’ll be done. But if he starts with any other bot, he can still find a path that leads
straight back to the zero-bot by following a simple set of instructions. To help craft them, let’s first
simplify the problem. Let’s say there were only
three furnace-bots; a parent and two children, but you don’t
know which is which. You could have Hedge pick one at
random and look inside its furnace. Now, you know the family tree
looks like this. If the number inside the furnace is a 0,
you’ve found the parent. If not, then no matter
which child you chose, it must have the parent’s serial
number in its furnace. So in this scenario, you’re guaranteed to
find the parent in one or two moves. In actuality, there are many
furnace-bots, and you don’t know how
many generations there are nor what the family tree looks like. But you don’t need to, because Hedge can just keep repeating
the same sequence of actions until he gets to the original. How? With a loop. Hedge can pick any bot at random,
look inside its furnace, and store that serial
number as a variable. Then he’ll begin the following
loop that will repeat until the stored variable equals 0, the furnace number of the original bot: 1. Find the bot whose shell serial number
matches the stored number. 2. Look inside its furnace. 3. Store that new number,
overwriting the old one. Once the loop ends, we’ll know that
Hedge has found the zero bot, so he should upload the control program. So here’s what happens: Hedge only takes 5 repetitions
to find the original: robot 733 has the 0 in its furnace. In a blink of a mechanical eye the
program spreads through the entire army, and Adila takes control. She has the furnace-bots give off
theatrical bouts of flame to hide the fact that they’re now secretly safe-guarding
all of that artistic output. Now that Ethic’s delivered
the furnace-bots, Adila honors her end of the deal. She leads Ethic and Hedge to the
location of the first artifact, the Node of Power. There, one thing is immediately clear: they’ll have to steal it.

100 thoughts on “The Furnace Bots | Think Like A Coder, Ep 3”

  1. 7 episodes remain! Don't want to miss the action? Make sure to subscribe and turn on notifications! Whether you're a coder or not, this epic adventure is for you. There will be varying levels of difficulty throughout each episode. See if you can rise to the challenge!

  2. can you make all the rules clear like you do in the riddles because i did this and was really confused because i did not know you could look into the furnaces bots moth

  3. Yeah but do the relationships between the bots have anything to do with their physical locations? So assuming you know where every bot is and their serial numbers this would be an effective solution but otherwise it’s not effective

  4. My issue is it makes the assumption that all serial numbers are known in advance, and dont need to be found. If you open the first bot, and find a 4 in the furnace, this solution only makes sense if you know where to find the bot with serial number 4, or if finding that is significantly faster than checking inside the furnace. Otherwise, this is actually worse than just systematically checking inside every furnace. Checking every furnace for 0 is O(n), this is probably closer to O(2n) if you don’t know where every serial number starts out

  5. When you said that Hedge could see all the numbers on the bots' shells, it wasn't clear that Hedge could find a specific number on a shell in O(1) time. If it took linear time, you could simply look at every bot.

  6. You should have mentioned that this is an optimisation problem. Of course, hedge can find the zero bot eventually by checking the furnace number of all bots one by one but it will take much less number of moves if it follows the generation serial numbers like a linked list in a loop.

  7. this is kinda irrelevant, but i wanna know how to make that shader at the end, the one on the dome. probably gonna figure it out myself

  8. Before I learned animations, why ted ed takes so long to upload new videos after I learned animations I am like "How on the earth ted ed upload new videos so fast?"

  9. 1:35

    Uh, no? That works in theory, but in this case theory and practice are farther apart than usual. If any non-leaf furnacebot has been destroyed without its children also having been destroyed, large sections of the tree no longer are connected to the root.

  10. I first started watching TED-Ed because for the math riddles you always specify all the information needed, and never leave any out like a lot of riddles do.

    My problem with this series is that you don't do that. I am a professional programmer, but I often don't solve these because you're not actually specifying the requirements. For example, what you miss here is "It is very costly to look in a furnacebot's furnace, but you can easily scan the crowd and find one with a given external serial number". Without that assumption, I thought "look in furnace" and "look at shell" were about equally costly, in which case the best you can do is check each one in turn instead of traversing the tree structure. I knew you probably wanted me to use the tree structure somehow, but you didn't give the information about how it could be useful.

    For the last episode, you didn't say that you could magically know somebody's name. That's an even worse oversight in theory, but in practice, it was clear that assumption was needed so it didn't hurt as much.

  11. Firstly, I'm enjoying this series!

    However, this case I think it not well set up as your solution implies that there is no cost for Hedge to find a Furnace Bot's parent which was not explicitly stated in the problem. If Hedge cannot immediately find a Furnace Bot's parent then it would need to search the entire set of Furnace Bots each time to find the parent; this would lead to a time complexity of something like O(n * log2(n)) in the worst case. A better solution would be simply searching each Furnace Bot for a zero which would have a time complexity of O(n). I am, of course, assuming there is little cost for checking inside a Furnace Bot.

  12. Literal mind blown of how smoothly this video explains coding, thats what ive been missing in class, the intuitive part of it THANKS

  13. I see how you can associate this with solving math problems. Practicing analytic thinking in math can help in other things too like programing. You don't need to be good at math to be good at analysing and solving other problems tho but you need to practice analysing just pointing out the relation.

  14. Amazing series for understanding coding basics
    The story-line, animation and theme song are amazing and also interesting; also the the script is amazing: "blink of mechanical eye"
    Please release further videos as soon as possible
    Thanks for this wonderful series.
    Love you Ted-Ed

  15. I am a coder myself and love to try my hand at the problems you present ^^"
    Especially love the fact, that it brings me to think simpler!
    I work with SAP-ABAP (archaic, I know, but I love it 🙂 ) and there you use a TON of tables.
    So my first instinct was to store everything in a table and then… I stopped myself and started to ask "WHY?" I don't NEED to know every number of every furnace, only the one.
    Who cares about the rest?
    And suddenly my pseudocode shrunk by about 70% ^^
    Looking forward to the next one!

  16. This reminded me of the game Human Resource Machine , great series anyway , This is quite easy for an actual coder but it is a brilliant way to give people the sense of programming

  17. Or you could have just made them as a table and set get them with pandas or your own function and then checked if there serial is that. This is assuming this is OOP but then again you could have created your own system with what was talked in this lesson, variables.

  18. So as a CS undergrad I have a few questions that I hope someone can explain:

    1- since the serial numbers are random and each bot inherits its parent serial number there is a possibility that one gets a 0 as a serial number and therefore there could be two bots with 0 as their parents serial number. (The radix of the tree and another) now you could say it is a given but since it’s not specified you cannot assume that and this shows how picky modern architectures really are. And in this case instead of a O(h) complexity it would be an O(n) one because you would have to cycle all robots.

    2- why explain the for loop and if, else statements before explaining what a variable is?!

    3-Why explain a tree structure before explaining what arrays and indexing

  19. Here is a C# solution if your robots are in an array with the properties of FurnaceNumber and ShellSerial.

    int currentFurnaceNumber = robots[0].FurnaceNumber;

    while(currentFurnaceNumber != 0)


    currentFurnaceNumber = robots.FirstOrDefault(robot => robot.ShellSerial == currentFurnaceNumber).FurnaceNumber;


  20. Just so you know, I really really like reading, art, and literature, so if furnace bots were real, that would be very very very bad news for me.

  21. Love these vids, the storyline, characters and educative aspects!
    I'm a high school kid trying to learn programming in my computer science class, and these vids help quite a bit and keep me inspired to learn more.
    Keep up the good work! I'll be eagerly waiting for the next vid. :>

  22. Wow! I got it after, hint, though I feel confident of my skills now (*happy realisation). Thanks ted ed for this wonderful and innovative, intuitive series. And yeah do read all other comments 'cause that is what I want to say but…
    To tired of writing this much itself so, trying to use an "until" loop, "until all comments are read".

  23. The animations are so cool! Especially the piano! (See that piano in the beginning? That’s a reminder for all procrastinating musicians to practice.)

  24. I am just a 12 years old and i knew they were supposed to use loop and variable

    That was kind of easy

    I am a big fan of TedEd keep up the good work the next generation (me and my friends) are learning from you and i hope if i ever become an inventor or someone special in society i will tell everyone that most of my knowledge was from you 😅🤩🤩🤩🤩❤

Leave a Reply

Your email address will not be published. Required fields are marked *