< Return to Video

The Factory | Think Like A Coder, Ep 9

  • Not Synced
    After a harrowing chase, Ethic, Hedge,
    and their new ally Lemma
  • Not Synced
    find themselves in a cavernous
    control room.
  • Not Synced
    Here the last artifact—
    the Node of Memory—
  • Not Synced
    is suspended within a force field
    and powering a supercomputer.
  • Not Synced
    Ethic is about to deactivate the force
    field when Lemma stops her.
  • Not Synced
    She explains, a decade ago, she was
    assigned a research task:
  • Not Synced
    to use the world machine to create
    something that would make everyone happy.
  • Not Synced
    After many failed attempts, Lemma
    discovered a compound that, when ingested,
  • Not Synced
    made people motivated, happy, creative,
    loving…in short, their best selves.
  • Not Synced
    It was rushed into production.
  • Not Synced
    Soon, the entire nation’s food supply came
    from Huxenborg,
  • Not Synced
    with the compound mixed in.
  • Not Synced
    The first year was paradise.
  • Not Synced
    The second, not so much.
  • Not Synced
    Side-effects began to emerge: memory-loss,
    listlessness, and self-absorption.
  • Not Synced
    In the third year, the government
    dissolved,
  • Not Synced
    leaving the robots running everything
    in a self-sustaining loop.
  • Not Synced
    By this point things were too far gone
    for Lemma to reverse.
  • Not Synced
    People had become dependent on the
    compound,
  • Not Synced
    and the few who refused it formed a
    resistance to try to fix things.
  • Not Synced
    It took 10 years for Lemma to find a cure.
  • Not Synced
    This factory contains everything she’ll
    need to make it,
  • Not Synced
    but the second they take the Node
    of Memory,
  • Not Synced
    the security system will alert the robots,
    and they’ll have to run.
  • Not Synced
    If, instead, they first reconfigure the
    factory to manufacture the cure,
  • Not Synced
    the people can be saved.
  • Not Synced
    Lemma has the whole factory redesign
    planned out.
  • Not Synced
    The problem is… it’s a little
    hard to read.
  • Not Synced
    Her schematic shows all the steps in the
    manufacturing process
  • Not Synced
    needed to make the cure.
  • Not Synced
    An arrow from “add nitric acid” to
    “shake vigorously”
  • Not Synced
    means that the acid addition has to
    happen before shaking.
  • Not Synced
    If a single step is performed
    out of order,
  • Not Synced
    the cure won’t work, or worse.
  • Not Synced
    There aren’t any circular references,
    where step A requires step B
  • Not Synced
    and step B eventually requires step A.
  • Not Synced
    Here’s where Ethic and Hedge come in.
  • Not Synced
    Lemma needs Hedge to translate the
    tangled diagram into a sequence of steps.
  • Not Synced
    That’ll be the order that things happen
    in the factory.
  • Not Synced
    Once input into the central computer,
  • Not Synced
    the factory will reassemble
    itself as instructed.
  • Not Synced
    Hedge’s ability to store information in a
    table will help here.
  • Not Synced
    So how does Ethic program Hedge
    to turn out a correct sequence
  • Not Synced
    that can reconfigure the factory?
  • Not Synced
    :pause:
  • Not Synced
    It may help to first think about this
    problem as a human, rather than a machine.
  • Not Synced
    Given this diagram, it’s clear to start
    with getting a bowl,
  • Not Synced
    since no arrows point to it.
  • Not Synced
    How might you mark up the diagram
    to figure out what to do next?
  • Not Synced
    :pause:
  • Not Synced
    Diagrams like the one Lemma has drawn
    are called directed acyclic graphs.
  • Not Synced
    A graph is a representation of data
    that shows different elements
  • Not Synced
    and how they’re related to each other.
  • Not Synced
    Directed means that direction matters—
    as indicated by the arrows.
  • Not Synced
    Here A leads to B, but B
    doesn’t lead to A.
  • Not Synced
    And acyclic means that there aren’t
    any loops.
  • Not Synced
    Which is fortunate, because if there were,
    this problem wouldn’t be solvable.
  • Not Synced
    There’s a simple way to navigate the
    graph as a human:
  • Not Synced
    start with a step that doesn’t have any
    arrows pointing to it.
  • Not Synced
    Once you do that, cross out that step
    and all arrows leading from it.
  • Not Synced
    Choose another step with no arrows
    pointing to it,
  • Not Synced
    and repeat until you’ve hit every step.
  • Not Synced
    There are two things here that are tricky
    to translate for a robot.
  • Not Synced
    First, how do you keep track of the
    information?
  • Not Synced
    And second, what do you do if there
    are multiple options at the same time?
  • Not Synced
    For the first challenge,
  • Not Synced
    a convenient way for machines to
    store information is in a table.
  • Not Synced
    In this case, you can have Hedge list
    every step in the headers
  • Not Synced
    of both the rows and columns.
  • Not Synced
    Then he can go through
    the rows one at a time.
  • Not Synced
    On the schematic, what points to mix?
  • Not Synced
    Both shake and titrate.
  • Not Synced
    So Hedge should make a mark in
    both of their columns.
  • Not Synced
    He can do the same for every row,
    one at a time, to make a table like this.
  • Not Synced
    Of course the full table
    will be much bigger.
  • Not Synced
    Like a human, Hedge will also
    want to start
  • Not Synced
    from one of the steps that has
    no arrows pointing to it—
  • Not Synced
    which is the same as having no marks
    in its row.
  • Not Synced
    If there’s more than one,
  • Not Synced
    a convenient way to choose is to pick the
    one that’s alphabetically earliest,
  • Not Synced
    though other selection methods
    can work just as well.
  • Not Synced
    Next, Hedge can add that step to his
    running-order list,
  • Not Synced
    delete its entire column from the table—
  • Not Synced
    thus removing all the times
    it was a dependency––
  • Not Synced
    and loop back to the start.
  • Not Synced
    Because there are no circular
    references in the graph,
  • Not Synced
    each time we get here there’ll be at least
    one step with no remaining dependencies.
  • Not Synced
    Hedge can add the alphabetically earliest
    to his running-order list,
  • Not Synced
    remove it from the table, and loop
    back to the start again.
  • Not Synced
    So now we have a working loop,
  • Not Synced
    and it’ll run through all the elements
    in our table until none are left.
  • Not Synced
    Hedge drifts back and forth over the
    schematics,
  • Not Synced
    and soon he starts spitting
    out instructions,
  • Not Synced
    which Ethic uses to configure the
    assembly lines.
  • Not Synced
    With the three working together, they
    churn out thousands of doses of the cure
  • Not Synced
    in no time.
  • Not Synced
    Ethic finally plucks the Node of Memory
  • Not Synced
    from its holding field and
    trips the alarm.
  • Not Synced
    Within seconds bots are everywhere.
  • Not Synced
    As Ethic falls in shock, the Node
    restores not only her own memories,
  • Not Synced
    but reveals the last, missing pieces
    of the puzzle.
  • Not Synced
    Ethic built Hedge with a singular purpose:
  • Not Synced
    to construct a maze that would protect the
    world machine from a corrupt government.
  • Not Synced
    But in her haste,
    she made a critical mistake:
  • Not Synced
    she forgot to set the condition
    that would end the loop
  • Not Synced
    which told Hedge how large
    the maze should be.
  • Not Synced
    So Hedge built and built until he
    could build no longer.
  • Not Synced
    And then he was conflicted.
  • Not Synced
    He had to build a maze.
  • Not Synced
    But he couldn’t build further without
    hurting people
  • Not Synced
    or flying over the Bradbarrier,
  • Not Synced
    both forbidden by his programming.
  • Not Synced
    So he wandered the land and searched
    for a solution,
  • Not Synced
    until he happened upon the Node of Power,
    the Node of Creation,
  • Not Synced
    and the Node of Memory.
  • Not Synced
    He recognized their true,
    collective power:
  • Not Synced
    to grant self-awareness
    to those who lack it.
  • Not Synced
    With all three he’d be able to change
    his programming
  • Not Synced
    and fulfill his drive to transform
    the entire world into a giant maze.
  • Not Synced
    It wouldn’t be easy:
  • Not Synced
    the Nodes had safeguards to prevent
    robots from taking and using them.
  • Not Synced
    But if Hedge could find the right human
  • Not Synced
    and manipulate her with the
    promise of a heroic quest…
Title:
The Factory | Think Like A Coder, Ep 9
Speaker:
Alex Rosenthal
Description:

more » « less
Video Language:
English
Team:
closed TED
Project:
TED-Ed
Duration:
09:45

English subtitles

Revisions Compare revisions