The Furnace Bots | Think Like A Coder, Ep 3

610,910 views ・ 2019-11-18

TED-Ed


請雙擊下方英文字幕播放視頻。

譯者: Clement Fu 審譯者: 潘 可儿
[TED-Ed 原創系列]
《時代女神 x 程式邏輯革命》
[地點:八達圍]
[第三集:佔「零」]
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
熔爐內刻有 0,序號是未知的亂數
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
熔爐中的數字若是 0,就找到母體
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
直到儲存的變數等於 0 為止
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
暴龍編號 733 熔爐內正刻著 0
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
出奇制勝唯靠神偷
關於本網站

本網站將向您介紹對學習英語有用的 YouTube 視頻。 您將看到來自世界各地的一流教師教授的英語課程。 雙擊每個視頻頁面上顯示的英文字幕,從那裡播放視頻。 字幕與視頻播放同步滾動。 如果您有任何意見或要求,請使用此聯繫表與我們聯繫。

https://forms.gle/WvT1wiN1qDtmnspy7


This website was created in October 2020 and last updated on June 12, 2025.

It is now archived and preserved as an English learning resource.

Some information may be out of date.

隱私政策

eng.lish.video

Developer's Blog