Placeholder Image

Subtitles section Play video

  • Ethic and her robot Hedge agree to help the resistance leader, Adila,

    [TED-Ed 原創系列]

  • sabotage the art-incinerating furnace-bots.

    《時代女神 x 程式邏輯革命》

  • In exchange,

    [地點:八達圍]

  • Adila promises to lead them to the first object of Ethic's quest,

    [第三集:佔「零」]

  • an artifact called the Node of Power.

    焚燒文藝的黑魔熔爐獸已橫行無忌

  • Years ago, there was just one furnace-bot.

    彥霖和機器人凌杰要仗義擊潰惡黨

  • It had a 0 inside its furnace and an unknown,

    巾幗之約

  • randomly generated serial number.

    光復領袖艾德拉為救世雙俠當明燈

  • Over time, the original self-replicated to produce more identical furnace-bots.

    指引到第一枚瑰寶:力量之泉

  • Each child inherited the original's unknown serial number within its furnace,

    想當年,只有一隻熔爐獸

  • and had a random, unique serial number of its own inscribed on its shell.

    熔爐內刻有 0,序號是未知的亂數

  • The second generation of furnace- bots also self-replicated in the same way,

    時移世易,零母自我複製出相同個體

  • always passing their own serial numbers to their offspring's furnaces.

    子體在熔爐中繼承本體的未知序號

  • This continued on for many generations.

    外殼上則刻有自己獨特的隨機序號

  • Today, each furnace-bot receives its orders from its parent.

    第二代鐵甲暴龍同樣如斯繁衍

  • So if Ethic can find the original 0 bot and somehow change its instructions,

    將自己的序號傳到後代的熔爐中

  • she could take over the entire army, all at once.

    生生不息

  • Adila has the perfect solution:

    每只暴龍如今都對母體唯命是從

  • a data crystal that she's been carrying for years,

    倘若彥霖找到零母始祖改變指令

  • waiting for the right moment to activate it.

    就能一舉拿下整支黑魔兵團

  • It contains a program designed to gain control of a bot

    艾德拉有一個無懈可擊的辦法

  • and give it new instructions.

    多年來她隨身收藏一枚資料水晶

  • But if it's uploaded to any furnace- bot other than the original,

    就看準時機用在一時

  • the 0 bot will override the instructions

    水晶有一個程式能掌控鐵甲魔獸

  • and destroy the data crystal in the process.

    重新對牠發號施令

  • The feeding is just a few minutes away,

    不過若上傳到始祖以外的鐵甲暴龍

  • and there's only one chance to get this right.

    零母就會覆寫指示

  • Fortunately, Hedge's ability to store data can help.

    並一併摧毀資料水晶

  • In programming,

    迫在眉睫的炊事日

  • a piece of information gets stored in something called a variable.

    就是押注成敗的千載一時

  • Variables are basically containers that hold onto numbers, words, or other values.

    幸好凌杰儲存資料的能力派上用場

  • How does Ethic program Hedge to find the original 0 bot as quickly as possible?

    程式設計中

  • Pause now to figure it out for yourself.

    一闋資訊能儲存到一個「變數」:

  • Here's a hint.

    即數字、文字或其他數值的載體

  • Programs can be written to have as many variables as you need,

    彥霖如何指令凌杰才儘快找到零母?

  • but you can solve this problem with just one.

    [動腦筋就按暫停,倒數五下給祕訣]

  • Hedge can use it to store a serial number

    祕訣:

  • and replace it with a new one as often as he needs.

    編寫程式變數多寡,隨心所欲無上限

  • Pause now to figure it out for yourself.

    但這道題用一個變數就行

  • A key insight here is that Hedge doesn't need to map out the entire

    凌杰可反覆用一個變數來儲存序號

  • set of relationships to find the original furnace-bot.

    需要時就換上新的序號

  • If, for example, he gets lucky and picks the original one right away,

    [動腦筋就按暫停,倒數五下揭謎底]

  • he'll be done.

    重點是凌杰不須比對出整個族譜

  • But if he starts with any other bot,

    才能找到零母始祖

  • he can still find a path that leads straight back to the 0-bot

    若幸運之神眷顧一挑就挑到零母

  • by following a simple set of instructions.

    就功德圓滿

  • To help craft them, let's first simplify the problem.

    挑上其他暴龍的話

  • Let's say there were only three furnace-bots;

    順藤摸瓜總能尋回零母

  • a parent and two children, but you don't know which is which.

    只需跟隨簡單的指令集

  • You could have Hedge pick one at random and look inside its furnace.

    先簡化一下問題,編指令沒難度

  • Now, you know the family tree looks like this.

    舉例說現在只有三只暴龍

  • If the number inside the furnace is a 0, you've found the parent.

    一母兩子,哪只是哪只分不清楚

  • If not, then no matter which child you chose,

    就叫凌杰隨意挑一個窺探一下熔爐

  • it must have the parent's serial number in its furnace.

    族譜是這樣子已說在前頭

  • So in this scenario, you're guaranteed to find the parent in one or two moves.

    熔爐中的數字若是 0,就找到母體

  • In actuality, there are many furnace-bots,

    不然,無論挑哪一個子體

  • and you don't know how many generations there are

    熔爐內都找到母體的序號

  • nor what the family tree looks like.

    範例中找到母體只消一、兩下功夫

  • But you don't need to,

    回歸現實,鐵甲暴龍多不勝數

  • because Hedge can just keep repeating the same sequence of actions

    不知道已繁衍至多少代

  • until he gets to the original.

    族譜當然也不得而知

  • How? With a loop.

    但上述都不重要

  • Hedge can pick any bot at random, look inside its furnace,

    凌杰只消重覆一組相同的套路

  • and store that serial number as a variable.

    直至找到零母始祖為止

  • Then he'll begin the following loop that will repeat

    方法?就是用迴圈

  • until the stored variable equals 0,

    凌杰隨意挑一只暴龍窺探一下熔爐

  • the furnace number of the original bot:

    把熔爐內的序號儲存在一個變數

  • 1. Find the bot whose shell serial number matches the stored number.

    之後就重覆一個迴圈

  • 2. Look inside its furnace.

    直到儲存的變數等於 0 為止

  • 3. Store that new number, overwriting the old one.

    即是迴圈找到零母始祖就完成:

  • Once the loop ends, we'll know that Hedge has found the 0 bot,

    一、找出外殼序號脗合變數的暴龍

  • so he should upload the control program.

    二、查看暴龍的熔爐

  • So here's what happens:

    三、記下數字,變數換成新序號

  • Hedge only takes 5 repetitions to find the original:

    迴圈告終時,即代表凌杰找到零母

  • robot 733 has the 0 in its furnace.

    就可以把掌控程式上傳

  • In a blink of a mechanical eye,

    言歸正傳

  • the program spreads through the entire army, and Adila takes control.

    凌杰只消五下功夫便找到零母:

  • She has the furnace-bots give off theatrical bouts of flame

    暴龍編號 733 熔爐內正刻著 0

  • to hide the fact that they're now secretly safe-guarding

    倏忽之間,程式就在兵團中傳開

  • all of that artistic output.

    落入艾德拉掌控

  • Now that Ethic's delivered the furnace-bots,

    她令暴龍施放煙幕特效的火之幻術

  • Adila honors her end of the deal.

    暗度陳倉保守吞噬的文藝著作

  • She leads Ethic and Hedge to the location of the first artifact,

    彥霖功成交付馴服的熔爐獸團

  • the Node of Power.

    艾德拉也信守巾幗之約

  • There, one thing is immediately clear:

    為彥霖凌杰引路到第一枚瑰寶:

  • they'll have to steal it.

    力量之泉

Ethic and her robot Hedge agree to help the resistance leader, Adila,

[TED-Ed 原創系列]

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it