B1 中級 美國腔 128 分類 收藏
開始影片後,點擊或框選字幕可以立即查詢單字
字庫載入中…
回報字幕錯誤
Ethic and her robot Hedge agree to help the resistance leader, Adila,
sabotage the art-incinerating furnace-bots.
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.
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.
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.
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
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.
提示:點選文章或是影片下面的字幕單字,可以直接快速翻譯喔!

載入中…

The Furnace Bots | Think Like A Coder, Ep 3

128 分類 收藏
ally.chang 發佈於 2020 年 2 月 26 日
看更多推薦影片
  1. 1. 單字查詢

    在字幕上選取單字即可即時查詢單字喔!

  2. 2. 單句重複播放

    可重複聽取一句單句,加強聽力!

  3. 3. 使用快速鍵

    使用影片快速鍵,讓學習更有效率!

  4. 4. 關閉語言字幕

    進階版練習可關閉字幕純聽英文哦!

  5. 5. 內嵌播放器

    可以將英文字幕學習播放器內嵌到部落格等地方喔

  6. 6. 展開播放器

    可隱藏右方全文及字典欄位,觀看影片更舒適!

  1. 英文聽力測驗

    挑戰字幕英文聽力測驗!

  1. 點擊展開筆記本讓你看的更舒服

  1. UrbanDictionary 俚語字典整合查詢。一般字典查詢不到你滿意的解譯,不妨使用「俚語字典」,或許會讓你有滿意的答案喔