The Furnace Bots | Think Like A Coder, Ep 3

596,100 views ・ 2019-11-18

TED-Ed


Please double-click on the English subtitles below to play the video.

00:35
Ethic and her robot Hedge agree to help the resistance leader, Adila,
0
35753
5043
00:40
sabotage the art-incinerating furnace-bots.
1
40796
3770
00:44
In exchange,
2
44566
996
00:45
Adila promises to lead them to the first object of Ethic’s quest,
3
45562
4784
00:50
an artifact called the Node of Power.
4
50346
4331
00:54
Years ago, there was just one furnace-bot.
5
54677
3051
00:57
It had a 0 inside its furnace and an unknown,
6
57728
3489
01:01
randomly generated serial number.
7
61217
3000
01:04
Over time, the original self-replicated to produce more identical furnace-bots.
8
64217
6557
01:10
Each child inherited the original’s unknown serial number within its furnace,
9
70774
5268
01:16
and had a random, unique serial number of its own inscribed on its shell.
10
76042
5467
01:21
The second generation of furnace- bots also self-replicated in the same way,
11
81509
4931
01:26
always passing their own serial numbers to their offspring’s furnaces.
12
86440
5003
01:31
This continued on for many generations.
13
91443
3710
01:35
Today, each furnace-bot receives its orders from its parent.
14
95153
4479
01:39
So if Ethic can find the original 0 bot and somehow change its instructions,
15
99632
6115
01:45
she could take over the entire army, all at once.
16
105747
4429
01:50
Adila has the perfect solution:
17
110176
2695
01:52
a data crystal that she’s been carrying for years,
18
112871
3554
01:56
waiting for the right moment to activate it.
19
116425
2941
01:59
It contains a program designed to gain control of a bot
20
119366
4094
02:03
and give it new instructions.
21
123460
2355
02:05
But if it’s uploaded to any furnace- bot other than the original,
22
125815
4056
02:09
the 0 bot will override the instructions
23
129871
2870
02:12
and destroy the data crystal in the process.
24
132741
3624
02:16
The feeding is just a few minutes away,
25
136365
2395
02:18
and there’s only one chance to get this right.
26
138760
3559
02:22
Fortunately, Hedge’s ability to store data can help.
27
142319
4249
02:26
In programming,
28
146568
1205
02:27
a piece of information gets stored in something called a variable.
29
147773
4344
02:32
Variables are basically containers that hold onto numbers, words, or other values.
30
152117
6490
02:38
How does Ethic program Hedge to find the original 0 bot as quickly as possible?
31
158607
6695
02:45
Pause now to figure it out for yourself.
32
165302
2790
02:49
Here’s a hint.
33
169956
1353
02:51
Programs can be written to have as many variables as you need,
34
171309
4220
02:55
but you can solve this problem with just one.
35
175529
3341
02:58
Hedge can use it to store a serial number
36
178870
2794
03:01
and replace it with a new one as often as he needs.
37
181664
3606
03:05
Pause now to figure it out for yourself.
38
185270
2444
03:10
A key insight here is that Hedge doesn’t need to map out the entire
39
190129
4439
03:14
set of relationships to find the original furnace-bot.
40
194568
3923
03:18
If, for example, he gets lucky and picks the original one right away,
41
198491
4449
03:22
he’ll be done.
42
202940
1080
03:24
But if he starts with any other bot,
43
204020
2418
03:26
he can still find a path that leads straight back to the 0-bot
44
206438
4273
03:30
by following a simple set of instructions.
45
210711
3720
03:34
To help craft them, let’s first simplify the problem.
46
214431
3620
03:38
Let’s say there were only three furnace-bots;
47
218051
2772
03:40
a parent and two children, but you don’t know which is which.
48
220823
3809
03:44
You could have Hedge pick one at random and look inside its furnace.
49
224632
4777
03:49
Now, you know the family tree looks like this.
50
229409
3840
03:53
If the number inside the furnace is a 0, you’ve found the parent.
51
233249
3954
03:57
If not, then no matter which child you chose,
52
237203
3345
04:00
it must have the parent’s serial number in its furnace.
53
240548
3810
04:04
So in this scenario, you’re guaranteed to find the parent in one or two moves.
54
244358
6315
04:10
In actuality, there are many furnace-bots,
55
250673
2890
04:13
and you don’t know how many generations there are
56
253563
2683
04:16
nor what the family tree looks like.
57
256246
2605
04:18
But you don’t need to,
58
258851
1589
04:20
because Hedge can just keep repeating the same sequence of actions
59
260440
3921
04:24
until he gets to the original.
60
264361
2242
04:26
How? With a loop.
61
266603
2409
04:29
Hedge can pick any bot at random, look inside its furnace,
62
269012
3880
04:32
and store that serial number as a variable.
63
272892
3318
04:36
Then he’ll begin the following loop that will repeat
64
276210
3405
04:39
until the stored variable equals 0,
65
279615
2706
04:42
the furnace number of the original bot:
66
282321
3270
04:45
1. Find the bot whose shell serial number matches the stored number.
67
285591
5428
04:51
2. Look inside its furnace.
68
291019
2960
04:53
3. Store that new number, overwriting the old one.
69
293979
5120
04:59
Once the loop ends, we’ll know that Hedge has found the 0 bot,
70
299099
4340
05:03
so he should upload the control program.
71
303439
2685
05:06
So here’s what happens:
72
306124
1628
05:07
Hedge only takes 5 repetitions to find the original:
73
307752
3729
05:11
robot 733 has the 0 in its furnace.
74
311481
4100
05:15
In a blink of a mechanical eye,
75
315581
2094
05:17
the program spreads through the entire army, and Adila takes control.
76
317675
5136
05:22
She has the furnace-bots give off theatrical bouts of flame
77
322811
3449
05:26
to hide the fact that they’re now secretly safe-guarding
78
326260
3343
05:29
all of that artistic output.
79
329603
3040
05:32
Now that Ethic’s delivered the furnace-bots,
80
332643
2397
05:35
Adila honors her end of the deal.
81
335040
3460
05:38
She leads Ethic and Hedge to the location of the first artifact,
82
338500
3901
05:42
the Node of Power.
83
342401
2579
05:44
There, one thing is immediately clear:
84
344980
3016
05:50
they’ll have to steal it.
85
350086
1720
About this website

This site will introduce you to YouTube videos that are useful for learning English. You will see English lessons taught by top-notch teachers from around the world. Double-click on the English subtitles displayed on each video page to play the video from there. The subtitles scroll in sync with the video playback. If you have any comments or requests, please contact us using this contact form.

https://forms.gle/WvT1wiN1qDtmnspy7