The Factory Think Like A Coder Ep 9

After a harrowing chase,
Ethic, Hedge, and their new ally Lemma

find themselves
in a cavernous control room.

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.

Lemma needs Hedge to translate
the tangled diagram

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

Hint in 3

Hint in 2

Hint in 1

It may help to first think about
this problem as a human,

rather than a machine.

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

Diagrams like the one Lemma has drawn
are called directed acyclic graphs.

A graph is a representation of data
that shows different elements

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.

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.

经过一场令人痛心的追逐后,
Ethic、Hedge 和他们的新盟友 Lemma

发现自己
身处一个巨大的控制室。

在这里,最后一个人工制品
——记忆节点——

被悬挂在一个力场中
并为一台超级计算机提供动力。

当 Lemma 阻止她时,Ethic 即将停用力场。

她解释说,十年前,
她被分配了一项研究任务

:利用世界机器创造
出让每个人都开心的东西。

在多次失败的尝试之后,Lemma
发现了一种化合物,当人们摄入后,

它会让人充满动力、快乐、创造力、
爱……简而言之,就是他们最好的自己。

它被匆忙投入生产。

很快,整个国家的粮食供应
都来自于胡森堡,

混入了大院

。第一年是天堂。

第二个,不多。

副作用开始出现:记忆力减退、
无精打采和专心致志。

第三年
,政府解散,

让机器人
在一个自我维持的循环中运行一切。

至此
,Lemma 已经无法逆转了。

人们已经变得
依赖这个大院

,少数拒绝它的人
形成了试图解决问题的阻力。

Lemma 花了 10 年时间才找到治疗方法。

这家工厂包含了
她制造它所需的一切,

但一旦他们
拿到记忆节点

,安全系统就会提醒机器人
,它们必须运行。

相反,如果他们首先重新配置
工厂来生产治疗药物

,人们就可以得救。

引理计划了整个工厂的重新设计

问题是……
它有点难以阅读。

她的示意图显示

了固化所需的制造过程中的所有步骤。

从“添加硝酸”
到“剧烈摇动”的箭头

表示
必须在摇动之前添加酸。

如果一个步骤的
执行顺序不正确,

则治疗将不起作用,或者更糟。

没有任何循环引用,
其中步骤 A 需要步骤 B,

而步骤 B 最终需要步骤 A。

这就是 Ethic 和 Hedge 的用武之地。

引理需要 Hedge
将纠结的图

转换为一系列步骤。

这将是工厂中事情发生的顺序

一旦输入中央计算机

,工厂将
按照指示重新组装。

Hedge 将信息存储
在表格中的能力在这里会有所帮助。

那么,Ethic 如何对
Hedge 进行编程以

产生可以重新配置工厂的正确序列?

现在停下来自己弄清楚。

3

条规则 2

条规则 1 条

提示 3 条

提示 2 条

提示 1 条提示

首先将
这个问题视为人类

而不是机器可能会有所帮助。

鉴于此图,从
拿一个碗开始是很清楚的,

因为没有箭头指向它。

您如何标记图表
以弄清楚下一步该做什么?

现在停下来自己弄清楚。

3 中的

解决方案 2 中的

解决方案 1 中的解决方案

类似于引理绘制
的图称为有向无环图。

图表是数据的表示,
它显示了不同的元素

以及它们如何相互关联。

定向意味着方向很重要——
如箭头所示。

这里 A 导致 B,
但 B 不会导致

A。非循环意味着
没有任何循环。

这是幸运的,因为如果有,
这个问题将无法解决。

有一种简单的方法可以
像人类一样导航图表:

从没有
任何箭头指向的步骤开始。

一旦你这样做了,划掉那一步
和所有从它引出的箭头。

选择另一个没有指向它的箭头的步骤,

然后重复,直到你完成每一步。

对于机器人来说,这里有两件事很难翻译。

首先,您如何
跟踪信息?

其次,如果同时有多个选项,你会怎么做

对于第一个挑战,

机器存储信息的一种便捷方式是在表格中。

在这种情况下,您可以在行和列
的标题中列出每个步骤

然后他可以
一次通过一排。

在原理图上,要混合哪些点?

摇动和滴定。

因此,Hedge 应该
在他们的两列中都做一个标记。

他可以对每一行做同样的事情,
一次一个,来制作这样一张桌子。

当然,整张桌子
会更大。

与人类一样,
Hedge 也希望从

没有箭头指向

它的步骤之一开始——这与在其行中没有标记相同

如果有多个,

一种方便的选择方法是选择
按字母顺序最早的一个,

尽管其他选择方法
也可以。

接下来,Hedge 可以将该步骤添加
到他的运行顺序列表中,从表中

删除它的整个列——

从而删除
它作为依赖项的所有时间——

然后循环回到起点。

因为图中没有循环
引用,所以

每次我们到达这里都会有至少
一个没有剩余依赖的步骤。

Hedge 可以将字母顺序最早的添加
到他的运行顺序列表中,

将其从表中删除,
然后再次循环回到开始。

所以现在我们有一个工作循环

,它将遍历
我们表中的所有元素,直到一个都没有。

Hedge
在原理图上来回移动

,很快他开始
吐出指令

,Ethic 用这些指令来
配置装配线。

三人一起工作,

他们很快就生产出数千
剂治疗药物。

Ethic 最终将记忆节点

从它的控制区域中取出
并触发了警报。

几秒钟之内,机器人无处不在。

Ethic 震惊不已,Node
不仅恢复了她自己的记忆,

还揭示了拼图最后的缺失部分

Ethic 建造 Hedge 的目的只有一个

:建造一个迷宫,
保护世界机器

免受腐败政府的侵害。

但在匆忙中,
她犯了一个严重的错误。

她忘记设置
结束循环的条件,该循环

告诉赫奇
迷宫应该有多大。

因此,赫奇不断地建造,
直到他无法建造为止。

然后他很矛盾。

他必须建造一个迷宫。

但他不能在
不伤害人

或飞越布拉德屏障的情况下进一步建造,

这两者都被他的编程所禁止。

于是他在这片土地上徘徊
并寻找解决方案,

直到他遇到了
力量节点、

创造节点和记忆节点。

他认识到他们真正的
集体力量,

可以将自我意识
赋予那些缺乏自我意识的人。

有了这三个,他将
能够改变他的程序

并实现他
将整个世界变成一个巨大的迷宫的动力。

这并不容易

:节点有保护措施来防止
机器人拿走和使用它们。

但如果赫奇能找到合适的人,


用英雄任务的承诺来操纵她

……那将是一个不同的故事。

一个非常不同的故事。