工厂 | 像程序员一样思考,第九集 Alex Rosenthal: The Factory | Think Like A Coder, Ep 9

上映日期: 0

语言:

影片类型:

导演:

演员: Alex Rosenthal


台词
After a harrowing chase, Ethic, Hedge, and their new ally Lemma
在经历了一场艰难的追逐之后,
find themselves in a cavernous control room.
艾西克(Ethic),赫奇 (Hedge) 和他们的新盟友莱玛 (Lemma)
Here the last artifact— the Node of Memory—
发现他们在似巨穴的的控制室里。
is suspended within a force field and powering a supercomputer.
在这里最后一件工件—— 记忆节点——
Ethic is about to deactivate the force field when Lemma stops her.
就悬浮在力场内, 为超级计算机供电。
She explains, a decade ago, she was assigned a research task:
艾西克正要解除力场时, 莱玛阻止了她。
to use the world machine to create something that would make everyone happy.
她解释说,十年前, 她被指派了一项研究任务:
After many failed attempts, Lemma discovered a compound that, when ingested,
用世界机器来创造出 能让每个人都开心的东西。
made people motivated, happy, creative, loving… in short, their best selves.
在经过多次失败的尝试后, 莱玛发现了一种化合物,
It was rushed into production.
服用后会让人变得有动力、 快乐,富有创造力和爱心……
Soon, the entire nation’s food supply came from Huxenborg,
简而言之,会成为最好的自己。
with the compound mixed in.
研发成功后,迅速投入了生产。
The first year was paradise.
很快,整个国家的食物供应 都来自胡森堡,
The second, not so much.
混合着这种化合物。
Side-effects began to emerge: memory-loss, listlessness, and self-absorption.
第一年,像天堂一样好。
In the third year, the government dissolved,
第二年,就没那么好了,
leaving the robots running everything in a self-sustaining loop.
副作用开始显现: 记忆缺失,无精打采和自我陶醉。
By this point things were too far gone for Lemma to reverse.
在第三年,政府瓦解了,
People had become dependent on the compound,
让机器人在一个 自我维持的循环中来运行一切。
and the few who refused it formed a resistance to try to fix things.
事到如今,以至于莱玛无法扭转局面。
It took 10 years for Lemma to find a cure.
人们开始变得依赖这种化合物,
This factory contains everything she’ll need to make it,
少数人奋力抵抗并试图去解决问题。
but the second they take the Node of Memory,
莱玛花了十年找到了解药。
the security system will alert the robots, and they’ll have to run.
这个工厂包含了 她制造解药所需的一切东西。
If, instead, they first reconfigure the factory to manufacture the cure,
但是当她们拿到记忆节点的瞬间,
the people can be saved.
安全系统就会启动机器人, 她们就不得不离开。
Lemma has the whole factory redesign planned out.
相反,如果她们先重新配置工厂 制造治疗药物,
The problem is… it’s a little hard to read.
人们就可以得救了。
Her schematic shows all the steps in the manufacturing process
莱玛已经计划好了 整个工厂的设计图。
needed to make the cure.
问题是……它有点难读。
An arrow from “add nitric acid” to “shake vigorously”
她的示意图显示了 生产过程中的所有步骤
means that the acid addition has to happen before shaking.
来制造解药。
If a single step is performed out of order,
一个从 “添加硝酸” 到 "剧烈摇动" 的箭头,
the cure won’t work, or worse.
意味着硝酸需要在摇晃之前加入。
There aren’t any circular references, where step A requires step B
如果一个步骤的顺序乱了,
and step B eventually requires step A.
解药就不会起作用,甚至更糟。
Here’s where Ethic and Hedge come in.
没有任何循环引用, 步骤 A 对应步骤 B ,
Lemma needs Hedge to translate the tangled diagram
和步骤 B 最终需要对应步骤 A 。
into a sequence of steps.
这是艾西克和赫奇进来的地方,
That’ll be the order that things happen in the factory.
莱玛需要赫奇把这个复杂的图表
Once input into the central computer,
转变为一系列的步骤。
the factory will reassemble itself as instructed.
这就是工厂里工序的顺序。
Hedge’s ability to store information in a table will help here.
一旦输入中央计算机,
So how does Ethic program Hedge to turn out a correct sequence
工厂将会根据指示自我重新组装。
that can reconfigure the factory?
赫奇在表中储存信息的能力 将在这里有所帮助。
Pause now to figure it out yourself.
那么艾西克如何指导 赫奇完成正确的顺序
Rules in 3
才可以重新配置工厂呢?
Rules in 2
【现在请停下来自己想想。】
Rules in 1
【规则将在 3 秒后显示】
Hint in 3
【2 秒】
Hint in 2
【1 秒】
Hint in 1
【提示将在 3 秒后显示】
It may help to first think about this problem as a human,
【2 秒】
rather than a machine.
【1 秒】
Given this diagram, it’s clear to start with getting a bowl,
首先,从人类的角度考虑 可能会有所帮助,
since no arrows point to it.
而不是机器的角度。
How might you mark up the diagram to figure out what to do next?
根据这个图表, 很清楚由 “借碗” 开始,
Pause now to figure it out yourself.
这是因为没有箭头指向它。
Solution in 3
那么如何标记图表 弄清楚接下来做什么?
Solution in 2
【现在请停下来自己想想。】
Solution in 1
【3 秒后答案揭晓】
Diagrams like the one Lemma has drawn are called directed acyclic graphs.
【2 秒后答案揭晓】
A graph is a representation of data that shows different elements
【1 秒后答案揭晓】
and how they’re related to each other.
像莱玛所画的的图称为有向非循环图。
Directed means that direction matters— as indicated by the arrows.
图是显示不同元素数据的一种表示
Here A leads to B, but B doesn’t lead to A.
以及它们之间的关系。
And acyclic means that there aren’t any loops.
有向是指箭头所表示的方向。
Which is fortunate, because if there were, this problem wouldn’t be solvable.
这里从 A 到 B ,但是 B 不到 A 。
There’s a simple way to navigate the graph as a human:
无环意味着这里没有任何的循环。
start with a step that doesn’t have any arrows pointing to it.
这很幸运,因为如果是循环的, 这个问题就没有办法解决。
Once you do that, cross out that step and all arrows leading from it.
有一个简单的方法把图当作人:
Choose another step with no arrows pointing to it,
从没有任何箭头指向的地方开始,
and repeat until you’ve hit every step.
一旦你这样做了,划掉这一步, 和所有从它开始的箭头。
There are two things here that are tricky to translate for a robot.
选择另一个没有箭头指向的步骤,
First, how do you keep track of the information?
然后重复,直到你完成了每一步。
And second, what do you do if there are multiple options at the same time?
对于机器人来说, 这里有两件事很难解决。
For the first challenge,
第一,如何跟踪这些信息?
a convenient way for machines to store information is in a table.
第二,如果同时有多个选择, 你会怎么做?
In this case, you can have Hedge list every step in the headers
对于第一个问题,
of both the rows and columns.
机器存储信息的 一种简便方法是在表中。
Then he can go through the rows one at a time.
在这种情况下,你可以让赫奇 在脑海里列出每一步,
On the schematic, what points to mix?
同时包括行和列。
Both shake and titrate.
然后他就可以每次通过一行。
So Hedge should make a mark in both of their columns.
在示意图上,哪些点应该混合?
He can do the same for every row, one at a time, to make a table like this.
同时摇晃和滴定。
Of course the full table will be much bigger.
所以赫奇应该在两栏同时都做标记。
Like a human, Hedge will also want to start
他可以对每一行都做一样的操作, 一次一个来创建这样的表。
from one of the steps that has no arrows pointing to it—
当然,整个表会更大。
which is the same as having no marks in its row.
就像人一样,
If there’s more than one,
赫奇也会从没有箭头指向的地方开始,
a convenient way to choose is to pick the one that’s alphabetically earliest,
这和行中没有标记是一样的。
though other selection methods can work just as well.
如果不止一个,
Next, Hedge can add that step to his running-order list,
一个方便的选择方法 是选择字母顺序最早的那个。
delete its entire column from the table—
虽然其他的选择方法 也能起到同样效果。
thus removing all the times it was a dependency––
接下来,赫奇可以将 这一步添加到他的运行顺序列表里,
and loop back to the start.
从表里删除整个列——
Because there are no circular references in the graph,
这样就消除了所有依赖项,
each time we get here there’ll be at least one step with no remaining dependencies.
然后循环回到开始。
Hedge can add the alphabetically earliest to his running-order list,
因为图中没有循环引用,
remove it from the table, and loop back to the start again.
所以每一次到达这里时, 至少有一个步骤没有剩余的依赖项。
So now we have a working loop,
赫奇可以把最早的字母顺序 加到他的运行顺序列表中,
and it’ll run through all the elements in our table until none are left.
从表里删除,然后循环回到开始。
Hedge drifts back and forth over the schematics,
所以现在我们有一个工作循环。
and soon he starts spitting out instructions,
并且它会经过表中的所有元素, 直到没有剩下。
which Ethic uses to configure the assembly lines.
赫奇在原理图上来回漂移,
With the three working together,
很快他就会吐出指令,
they churn out thousands of doses of the cure in no time.
艾西克可以借此来配置装配线。
Ethic finally plucks the Node of Memory
随着三个工作的同时进行,
from its holding field and trips the alarm.
他们很快生产出成千上万的治疗药物。
Within seconds bots are everywhere.
艾西克最终从力场中摘除了记忆节点,
As Ethic falls in shock, the Node restores not only her own memories,
并且同时触发了警报。
but reveals the last, missing pieces of the puzzle.
一瞬间到处都是机器人。
Ethic built Hedge with a singular purpose:
让艾西克震惊的是, 记忆节点不仅仅恢复了她的记忆。
to construct a maze that would protect the world machine
而且揭示了最后一块拼图的碎片。
from a corrupt government.
艾西克因为单一的目的创造了赫奇:
But in her haste, she made a critical mistake.
制造一个迷宫来保护世界机器,
She forgot to set the condition that would end the loop
来抵抗一个腐败的政府。
which told Hedge how large the maze should be.
但在匆忙之中, 她犯了一个严重的错误。
So Hedge built and built until he could build no longer.
她忘记设立一个条件来结束循环
And then he was conflicted.
来告诉赫奇迷宫应该多大。
He had to build a maze.
所以赫奇建了又建, 直到他不能再建为止。
But he couldn’t build further without hurting people
然后他就矛盾了。
or flying over the Bradbarrier,
他必须建造一个迷宫。
both forbidden by his programming.
但是他不能在不伤害 人类的情况下继续建造
So he wandered the land and searched for a solution,
也不能飞过布拉德屏障。
until he happened upon the Node of Power, the Node of Creation,
这些都被他的程序所禁止。
and the Node of Memory.
所以他在这片土地上游荡 并寻找解决方法。
He recognized their true, collective power
直到他偶然发现了力量节点、 创造节点,以及记忆节点。
to grant self-awareness to those who lack it.
他认识到了真正的集体力量。
With all three he’d be able to change his programming
赋予那些缺乏自我意识的人以力量。
and fulfill his drive to transform the entire world into a giant maze.
有了这三样他就可以改变自己的程序
It wouldn’t be easy:
完成把整个世界变成一个迷宫的壮举。
the Nodes had safeguards to prevent robots from taking and using them.
这并不简单:
But if Hedge could find the right human
这些节点有阻止机器人 取走和使用它们的保护措施。
and manipulate her with the promise of a heroic quest…
但是如果赫奇能够找到真正的人类,
well that would be a different story.
并且以英勇追求的承诺来瞒过她……
A very different story.
那就另当别论了,