The Factory | Think Like A Coder, Ep 9

384,782 views ・ 2020-06-23

TED-Ed


请双击下面的英文字幕来播放视频。

翻译人员: YUEYUAN DU
00:32
After a harrowing chase, Ethic, Hedge, and their new ally Lemma
0
32447
4555
在经历了一场艰难的追逐之后,
艾西克(Ethic),赫奇 (Hedge) 和他们的新盟友莱玛 (Lemma)
00:37
find themselves in a cavernous control room.
1
37002
7504
发现他们在似巨穴的的控制室里。
00:44
Here the last artifact— the Node of Memory—
2
44506
3320
在这里最后一件工件—— 记忆节点——
00:47
is suspended within a force field and powering a supercomputer.
3
47826
4838
就悬浮在力场内, 为超级计算机供电。
00:52
Ethic is about to deactivate the force field when Lemma stops her.
4
52664
4809
艾西克正要解除力场时, 莱玛阻止了她。
00:57
She explains, a decade ago, she was assigned a research task:
5
57473
4909
她解释说,十年前, 她被指派了一项研究任务:
01:02
to use the world machine to create something that would make everyone happy.
6
62382
4927
用世界机器来创造出 能让每个人都开心的东西。
01:07
After many failed attempts, Lemma discovered a compound that, when ingested,
7
67309
5048
在经过多次失败的尝试后, 莱玛发现了一种化合物,
01:12
made people motivated, happy, creative, loving… in short, their best selves.
8
72357
6677
服用后会让人变得有动力、 快乐,富有创造力和爱心……
简而言之,会成为最好的自己。
01:19
It was rushed into production.
9
79034
2040
研发成功后,迅速投入了生产。
01:21
Soon, the entire nation’s food supply came from Huxenborg,
10
81074
3670
很快,整个国家的食物供应 都来自胡森堡,
01:24
with the compound mixed in.
11
84744
2790
混合着这种化合物。
01:27
The first year was paradise.
12
87534
1970
第一年,像天堂一样好。
01:29
The second, not so much.
13
89504
2150
第二年,就没那么好了,
01:31
Side-effects began to emerge: memory-loss, listlessness, and self-absorption.
14
91654
5298
副作用开始显现: 记忆缺失,无精打采和自我陶醉。
01:36
In the third year, the government dissolved,
15
96952
2840
在第三年,政府瓦解了,
01:39
leaving the robots running everything in a self-sustaining loop.
16
99792
4588
让机器人在一个 自我维持的循环中来运行一切。
01:44
By this point things were too far gone for Lemma to reverse.
17
104380
3890
事到如今,以至于莱玛无法扭转局面。
01:48
People had become dependent on the compound,
18
108270
2850
人们开始变得依赖这种化合物,
01:51
and the few who refused it formed a resistance to try to fix things.
19
111120
4364
少数人奋力抵抗并试图去解决问题。
01:55
It took 10 years for Lemma to find a cure.
20
115484
3100
莱玛花了十年找到了解药。
01:58
This factory contains everything she’ll need to make it,
21
118584
3890
这个工厂包含了 她制造解药所需的一切东西。
02:02
but the second they take the Node of Memory,
22
122474
2240
但是当她们拿到记忆节点的瞬间,
02:04
the security system will alert the robots, and they’ll have to run.
23
124714
4242
安全系统就会启动机器人, 她们就不得不离开。
02:08
If, instead, they first reconfigure the factory to manufacture the cure,
24
128956
5183
相反,如果她们先重新配置工厂 制造治疗药物,
02:14
the people can be saved.
25
134139
2210
人们就可以得救了。
02:16
Lemma has the whole factory redesign planned out.
26
136349
3460
莱玛已经计划好了 整个工厂的设计图。
02:19
The problem is… it’s a little hard to read.
27
139809
2820
问题是……它有点难读。
02:22
Her schematic shows all the steps in the manufacturing process
28
142629
3620
她的示意图显示了 生产过程中的所有步骤
02:26
needed to make the cure.
29
146249
1680
来制造解药。
02:27
An arrow from “add nitric acid” to “shake vigorously”
30
147929
3880
一个从 “添加硝酸” 到 "剧烈摇动" 的箭头,
02:31
means that the acid addition has to happen before shaking.
31
151809
3870
意味着硝酸需要在摇晃之前加入。
02:35
If a single step is performed out of order,
32
155679
2670
如果一个步骤的顺序乱了,
02:38
the cure won’t work, or worse.
33
158349
2710
解药就不会起作用,甚至更糟。
02:41
There aren’t any circular references, where step A requires step B
34
161059
4652
没有任何循环引用, 步骤 A 对应步骤 B ,
02:45
and step B eventually requires step A.
35
165711
4434
和步骤 B 最终需要对应步骤 A 。
03:04
Here’s where Ethic and Hedge come in.
36
184771
2660
这是艾西克和赫奇进来的地方,
03:07
Lemma needs Hedge to translate the tangled diagram
37
187431
3528
莱玛需要赫奇把这个复杂的图表
03:10
into a sequence of steps.
38
190959
2220
转变为一系列的步骤。
03:13
That’ll be the order that things happen in the factory.
39
193179
2990
这就是工厂里工序的顺序。
03:16
Once input into the central computer,
40
196169
2280
一旦输入中央计算机,
03:18
the factory will reassemble itself as instructed.
41
198449
3700
工厂将会根据指示自我重新组装。
03:22
Hedge’s ability to store information in a table will help here.
42
202149
3830
赫奇在表中储存信息的能力 将在这里有所帮助。
03:25
So how does Ethic program Hedge to turn out a correct sequence
43
205979
4557
那么艾西克如何指导 赫奇完成正确的顺序
03:30
that can reconfigure the factory?
44
210536
2335
才可以重新配置工厂呢?
03:32
Pause now to figure it out yourself.
45
212871
1872
【现在请停下来自己想想。】
03:34
Rules in 3
46
214743
850
【规则将在 3 秒后显示】
03:35
Rules in 2
47
215593
968
【2 秒】
03:36
Rules in 1
48
216561
920
【1 秒】
03:39
Hint in 3
49
219470
1021
【提示将在 3 秒后显示】
03:40
Hint in 2
50
220491
975
【2 秒】
03:41
Hint in 1
51
221466
1145
【1 秒】
03:42
It may help to first think about this problem as a human,
52
222611
3899
首先,从人类的角度考虑 可能会有所帮助,
03:46
rather than a machine.
53
226510
1650
而不是机器的角度。
03:48
Given this diagram, it’s clear to start with getting a bowl,
54
228160
4161
根据这个图表, 很清楚由 “借碗” 开始,
03:52
since no arrows point to it.
55
232321
2780
这是因为没有箭头指向它。
03:55
How might you mark up the diagram to figure out what to do next?
56
235101
4540
那么如何标记图表 弄清楚接下来做什么?
03:59
Pause now to figure it out yourself.
57
239641
1970
【现在请停下来自己想想。】
04:01
Solution in 3
58
241611
880
【3 秒后答案揭晓】
04:02
Solution in 2
59
242491
1020
【2 秒后答案揭晓】
04:03
Solution in 1
60
243511
1126
【1 秒后答案揭晓】
04:04
Diagrams like the one Lemma has drawn are called directed acyclic graphs.
61
244637
6603
像莱玛所画的的图称为有向非循环图。
04:11
A graph is a representation of data that shows different elements
62
251240
4000
图是显示不同元素数据的一种表示
04:15
and how they’re related to each other.
63
255240
2257
以及它们之间的关系。
04:17
Directed means that direction matters— as indicated by the arrows.
64
257497
5734
有向是指箭头所表示的方向。
04:23
Here A leads to B, but B doesn’t lead to A.
65
263231
4198
这里从 A 到 B ,但是 B 不到 A 。
04:27
And acyclic means that there aren’t any loops.
66
267429
3720
无环意味着这里没有任何的循环。
04:31
Which is fortunate, because if there were, this problem wouldn’t be solvable.
67
271149
5079
这很幸运,因为如果是循环的, 这个问题就没有办法解决。
04:36
There’s a simple way to navigate the graph as a human:
68
276228
3480
有一个简单的方法把图当作人:
04:39
start with a step that doesn’t have any arrows pointing to it.
69
279708
3710
从没有任何箭头指向的地方开始,
04:43
Once you do that, cross out that step and all arrows leading from it.
70
283418
4890
一旦你这样做了,划掉这一步, 和所有从它开始的箭头。
04:48
Choose another step with no arrows pointing to it,
71
288308
3230
选择另一个没有箭头指向的步骤,
04:51
and repeat until you’ve hit every step.
72
291538
3680
然后重复,直到你完成了每一步。
04:55
There are two things here that are tricky to translate for a robot.
73
295218
4000
对于机器人来说, 这里有两件事很难解决。
04:59
First, how do you keep track of the information?
74
299218
2960
第一,如何跟踪这些信息?
05:02
And second, what do you do if there are multiple options at the same time?
75
302178
5321
第二,如果同时有多个选择, 你会怎么做?
05:07
For the first challenge,
76
307499
1250
对于第一个问题,
05:08
a convenient way for machines to store information is in a table.
77
308749
4240
机器存储信息的 一种简便方法是在表中。
05:12
In this case, you can have Hedge list every step in the headers
78
312989
4000
在这种情况下,你可以让赫奇 在脑海里列出每一步,
05:16
of both the rows and columns.
79
316989
2750
同时包括行和列。
05:19
Then he can go through the rows one at a time.
80
319739
2910
然后他就可以每次通过一行。
05:22
On the schematic, what points to mix?
81
322649
2861
在示意图上,哪些点应该混合?
05:25
Both shake and titrate.
82
325510
2350
同时摇晃和滴定。
05:27
So Hedge should make a mark in both of their columns.
83
327860
3540
所以赫奇应该在两栏同时都做标记。
05:31
He can do the same for every row, one at a time, to make a table like this.
84
331400
5158
他可以对每一行都做一样的操作, 一次一个来创建这样的表。
05:36
Of course the full table will be much bigger.
85
336558
4000
当然,整个表会更大。
05:40
Like a human, Hedge will also want to start
86
340558
2490
就像人一样,
05:43
from one of the steps that has no arrows pointing to it—
87
343048
3480
赫奇也会从没有箭头指向的地方开始,
05:46
which is the same as having no marks in its row.
88
346528
4215
这和行中没有标记是一样的。
05:50
If there’s more than one,
89
350743
1290
如果不止一个,
05:52
a convenient way to choose is to pick the one that’s alphabetically earliest,
90
352033
4762
一个方便的选择方法 是选择字母顺序最早的那个。
05:56
though other selection methods can work just as well.
91
356795
4065
虽然其他的选择方法 也能起到同样效果。
06:00
Next, Hedge can add that step to his running-order list,
92
360860
4000
接下来,赫奇可以将 这一步添加到他的运行顺序列表里,
06:04
delete its entire column from the table—
93
364860
2450
从表里删除整个列——
06:07
thus removing all the times it was a dependency––
94
367310
3030
这样就消除了所有依赖项,
06:10
and loop back to the start.
95
370340
2650
然后循环回到开始。
06:12
Because there are no circular references in the graph,
96
372990
3300
因为图中没有循环引用,
06:16
each time we get here there’ll be at least one step with no remaining dependencies.
97
376290
5574
所以每一次到达这里时, 至少有一个步骤没有剩余的依赖项。
06:21
Hedge can add the alphabetically earliest to his running-order list,
98
381864
4692
赫奇可以把最早的字母顺序 加到他的运行顺序列表中,
06:26
remove it from the table, and loop back to the start again.
99
386556
4665
从表里删除,然后循环回到开始。
06:31
So now we have a working loop,
100
391221
2020
所以现在我们有一个工作循环。
06:33
and it’ll run through all the elements in our table until none are left.
101
393241
4842
并且它会经过表中的所有元素, 直到没有剩下。
06:38
Hedge drifts back and forth over the schematics,
102
398083
3010
赫奇在原理图上来回漂移,
06:41
and soon he starts spitting out instructions,
103
401093
2970
很快他就会吐出指令,
06:44
which Ethic uses to configure the assembly lines.
104
404063
3230
艾西克可以借此来配置装配线。
06:55
With the three working together,
105
415794
1760
随着三个工作的同时进行,
06:57
they churn out thousands of doses of the cure in no time.
106
417554
3710
他们很快生产出成千上万的治疗药物。
07:14
Ethic finally plucks the Node of Memory
107
434285
2400
艾西克最终从力场中摘除了记忆节点,
07:16
from its holding field and trips the alarm.
108
436685
2970
并且同时触发了警报。
07:19
Within seconds bots are everywhere.
109
439655
2870
一瞬间到处都是机器人。
08:02
As Ethic falls in shock, the Node restores not only her own memories,
110
482272
5037
让艾西克震惊的是, 记忆节点不仅仅恢复了她的记忆。
08:07
but reveals the last, missing pieces of the puzzle.
111
487309
4085
而且揭示了最后一块拼图的碎片。
08:11
Ethic built Hedge with a singular purpose:
112
491394
2870
艾西克因为单一的目的创造了赫奇:
08:14
to construct a maze that would protect the world machine
113
494264
3422
制造一个迷宫来保护世界机器,
08:17
from a corrupt government.
114
497686
1800
来抵抗一个腐败的政府。
08:19
But in her haste, she made a critical mistake.
115
499486
3081
但在匆忙之中, 她犯了一个严重的错误。
08:22
She forgot to set the condition that would end the loop
116
502567
3220
她忘记设立一个条件来结束循环
08:25
which told Hedge how large the maze should be.
117
505787
3429
来告诉赫奇迷宫应该多大。
08:29
So Hedge built and built until he could build no longer.
118
509216
4617
所以赫奇建了又建, 直到他不能再建为止。
08:33
And then he was conflicted.
119
513833
1760
然后他就矛盾了。
08:35
He had to build a maze.
120
515593
1700
他必须建造一个迷宫。
08:37
But he couldn’t build further without hurting people
121
517293
3220
但是他不能在不伤害 人类的情况下继续建造
08:40
or flying over the Bradbarrier,
122
520513
2310
也不能飞过布拉德屏障。
08:42
both forbidden by his programming.
123
522823
2500
这些都被他的程序所禁止。
08:45
So he wandered the land and searched for a solution,
124
525323
3330
所以他在这片土地上游荡 并寻找解决方法。
08:48
until he happened upon the Node of Power, the Node of Creation,
125
528653
4130
直到他偶然发现了力量节点、 创造节点,以及记忆节点。
08:52
and the Node of Memory.
126
532783
2340
08:55
He recognized their true, collective power
127
535123
2730
他认识到了真正的集体力量。
08:57
to grant self-awareness to those who lack it.
128
537853
3010
赋予那些缺乏自我意识的人以力量。
09:00
With all three he’d be able to change his programming
129
540863
2910
有了这三样他就可以改变自己的程序
09:03
and fulfill his drive to transform the entire world into a giant maze.
130
543773
5251
完成把整个世界变成一个迷宫的壮举。
09:09
It wouldn’t be easy:
131
549024
1650
这并不简单:
09:10
the Nodes had safeguards to prevent robots from taking and using them.
132
550674
4745
这些节点有阻止机器人 取走和使用它们的保护措施。
09:15
But if Hedge could find the right human
133
555419
2770
但是如果赫奇能够找到真正的人类,
09:18
and manipulate her with the promise of a heroic quest…
134
558189
4000
并且以英勇追求的承诺来瞒过她……
09:22
well that would be a different story.
135
562189
2290
那就另当别论了,
09:24
A very different story.
136
564479
2560
就会是一个完全不同的故事。
关于本网站

这个网站将向你介绍对学习英语有用的YouTube视频。你将看到来自世界各地的一流教师教授的英语课程。双击每个视频页面上显示的英文字幕,即可从那里播放视频。字幕会随着视频的播放而同步滚动。如果你有任何意见或要求,请使用此联系表与我们联系。

https://forms.gle/WvT1wiN1qDtmnspy7