字幕表 動画を再生する
-
Their fall from the tower sends Ethic and Hedge
翻訳: Moe Shoji 校正: Yasushi Aoki
-
spinning into the rapids of a river of pure energy.
塔から落下したエシックとヘッジは
-
This torrent flows from the Bradbarrier all the way to Huxenborg.
エネルギーの急流に 飲み込まれてしまいます
-
There an entire city's worth of factories
この急流はブラッドバリアから ハクセンボーグまで延々と続いています
-
build the robots and house the Node of Memory,
ハクセンボーグでは 街中にあふれる工場で
-
the last of the three powerful artifacts Ethic needs to collect.
ロボットが生産されているほか
-
After a long day and a longer night
エシックが探し求める3つ目のアイテム 記憶の石も隠されています
-
they find themselves in a canyon of brick and steel.
一日中 そして一晩中流されるうちに
-
Just when they're about to reach the end of the line,
2人はブロックと鋼鉄でできた 渓谷にたどり着きました
-
a rope catches them.
ついに谷底へ真っ逆さまかと 思った その時
-
Their savior, Lemma, has been waiting for them.
ロープに助けられました
-
When Ethic claimed the Node of Creation from the forest tower,
2人を助けてくれたのは そこで待ち受けていたレマでした
-
radios all across the land came back to life.
森林の塔でエシックが 創造の石を手に入れた時
-
Adila, the resistance leader, immediately started contacting her allies,
国じゅうの通信が 回復したため
-
none more important than Lemma,
抵抗運動のリーダーのアディーラは すぐに仲間に呼びかけ始め
-
a brilliant scientist working from within Huxenborg to bring down the machines.
中でも重要だったのがレマでした
-
Unfortunately, the radios also tipped off the robots.
ハクセンボーグの街で機械を止めようと 取り組んでいる有能な科学者です
-
So they've taken defensive measures
あいにく無線通信は ロボットにも知られてしまい
-
to protect the final artifact in its home in the very heart of the city.
ロボットたちは街の中心にある 最後のアイテムを守るべく
-
There's only one way to get there: the gauntlet of forking paths.
防御態勢に入りました
-
It's a deadly series of luminous conveyors that wind underneath Huxenborg.
アイテムに到達する道はただひとつ 「分かれ道の難所」を抜ける必要があります
-
Starting from the current position,
ハクセンボーグの地下の暗闇に広がる 光るコンベヤーの迷路です
-
each section runs for a distance, then splits in two.
現在地点からスタートして
-
Every branch does the same thing, again and again.
一定距離を進むと 道が二手に分かれます
-
There are thousands of branches.
どの道も同じように 繰り返し枝分かれしていきます
-
Only one path leads to the artifact; all the others to destruction.
道は何千もあります
-
Fortunately, the Node of Creation has granted Hedge a strange power:
アイテムへと至るのはたったひとつ それ以外の道の先にあるのは破滅です
-
he can produce slightly smaller versions of himself.
幸い 創造の石のおかげで ヘッジには不思議な力が備わりました
-
Each version can do only two things: radio information back to its parent,
自分の小さなコピーを 生み出せるのです
-
and produce slightly smaller versions of itself…
コピーにできることは2つ 親に情報を送ることと
-
which can do the same two things, as can their children,
自分の小さなコピーを 生み出すことです
-
for as many generations as needed.
生み出された子や さらにその子にも 同じことができ
-
A patrol is closing in on their position, so Ethic's time is limited.
何世代でも作ることができます
-
What instructions should she give Hedge to find the one safe path?
警備の手が迫っており エシックには限られた時間しかありません
-
Pause the video to figure it out yourself.
安全な道を見つけるには ヘッジをどうプログラムしたらよいでしょう?
-
Hint in 3
ビデオをいったん止めて 自分で考えてみましょう
-
Hint in 2
ヒントまで 3秒
-
Hint in 1
ヒントまで 2秒
-
Programmers have an elegant tool in their arsenal called recursion.
ヒントまで 1秒
-
Recursion is when you have a set of instructions that refers back to itself.
プログラマーには「再帰」という とっておきの道具があります
-
It's like using a word in its own definition,
再帰というのは一連の指示が 自らの呼び出しを含んでいることを言います
-
except where that's frowned upon, this is incredibly effective.
言葉を定義するのに その言葉自体を使うようなものです
-
Recursion involves repetition, but in a different way than loops.
言葉の定義には良くなくとも プログラミングではとても役立ちます
-
Where a loop takes one action and repeats it again and again,
再帰では反復が行われますが ループとは違います
-
recursion will start an action, and before it's finished, use it again,
ループでは ある指示を 何度も繰り返し実行しますが
-
and before that's finished, use it again, and so on.
再帰では ある指示を実行し始めて 完了する前にその指示をまた実行し始め
-
It keeps doing this until some end state is reached.
それが完了する前にまた実行し始める という具合に繰り返されます
-
It then passes the information back up, layer after layer,
何らかの最終状態に到達するまで これが繰り返されます
-
until it reaches the top and ends the cycle.
それから一層一層 内から外へ 情報が受け渡されていき
-
Recursion is ideal for problems that involve self-similarity,
一番外まで来たら終了します
-
where each part resembles the larger whole.
再帰は 問題がそれ自身と 似た部分から構成されている
-
Like, for example, a deadly defense system designed to end any person or thing
自己相似的構造を 持つ場合に有用です
-
who dares tread upon it.
例えば 足を踏み入れる者を 抹殺するように設計された
-
Pause the video to figure it out yourself.
どこかの防御システムがそうです
-
Solution in 3
ビデオをいったん止めて 自分で考えてみましょう
-
Solution in 2
ヒントまで 3秒
-
Solution in 1
ヒントまで 2秒
-
Ethic's conundrum seems sprawling on the surface,
ヒントまで 1秒
-
but there's a remarkably simple solution to it using recursion.
エシックに与えられた難題は 表面的には不規則に見えますが
-
In order to find it, let's first look at the simplest version of this puzzle:
実は再帰を使った 非常に簡単な解決法があります
-
what if the entire maze were just two paths?
その方法を見つけるために まず一番簡単な形を考えてみましょう
-
If Hedge copies himself, the copy that goes the wrong way will be destroyed.
迷路に2つしか 道がなかったらどうでしょう?
-
So the other one, which will reach the artifact,
ヘッジがコピーを送り出せば 間違った方へ行ったものは破壊されます
-
can radio back the path it took, and then no matter which way is correct,
アイテムにたどり着いた もうひとつのコピーは
-
that's the answer Hedge will receive.
たどった道を報告できるので どちらが正しい道であろうと
-
This is called the "base case" of the recursion.
ヘッジは正しい答えを 受け取れます
-
Now, suppose the maze branches twice from the starting point,
これを再帰の「基本ケース」と言います
-
and at every intersection, Hedge's copies—
今度は迷路が出発点から2回 枝分かれするとしましょう
-
let's call them Twig 1 and Twig 2—
それぞれの分かれ道で ヘッジのコピー
-
make more copies— let's call them Leaves 1 through 4.
これを 枝 T1、T2 としておきますが
-
Three Leaves will be destroyed.
それが さらにコピーを作り 葉 L1~L4 ができます
-
The one that reaches the artifact will radio back the right answer,
葉のうち3つは破壊されます
-
but only to its parent.
アイテムに到達したものが 正しい答えを送り返しますが
-
So if Twig 1 or 2 is waiting at an intersection
受け取るのはその親だけです
-
and hears something over the radio,
分かれ道で待っている 枝 T1、T2 のどちらかが
-
that's the right way to go to the artifact from where it is.
無線で報告を受けたなら
-
To tell Hedge the right answer from his perspective,
そちらがアイテムへと続く 道だということです
-
the Twig should say which way it went,
ヘッジの視点から 正しい答えを伝えるには
-
and then the route it just heard over the radio.
枝は自分がどちらへ向かったかと
-
This same process will work no matter how many times the maze branches.
無線で報告された道筋を 教えればいいのです
-
Any answer a copy hears on the radio
分かれ道がいくつあろうと 同じやり方でいけます
-
must be the way to the control room from its location,
無線で聞いた答えが
-
and if it then adds the branch it took,
その地点からアイテムへと 向かう道筋であり
-
it can tell its parent how to get there as well.
自分がどの道筋をたどったか 付け加えれば
-
We can sum up the instructions in an action called Pathfinder
どうやってそこに行けるかを 親に伝えられます
-
that every version of Hedge will follow:
ヘッジのコピーたちが従うべきこの手順を 「パスファインダー」と名付けましょう
-
1. If you've reached the artifact,
① アイテムに到達したら
-
radio to your parent whether you got there by going left or right.
左右のどちらの道を通ったかを 親に伝えること
-
2. When you reach an intersection, move off the conveyor
② 分かれ道に来たら コンベヤーから降りて
-
and send new copies down the left and right paths.
新しいコピーを左右の道に送り出し
-
Have them each run Pathfinder.
どちらにもパスファインダーを 実行させること―
-
This is where recursion comes in,
ここで再帰を使っているわけです
-
and this may happen many times before the last instruction triggers, which is:
最後の指示が行われるまで それが何度も繰り返されます
-
3. If you hear anything over the radio, you should radio to your parent
③ 最後に なにか情報が報告されたら 親に報告し
-
whether you got to your spot by going left or right,
このとき 左右どちらの道を たどったかと
-
then repeat everything you just heard.
聞いた情報をすべて繰り返すこと
-
Pathfinder is an example of what programmers call functions,
パスファインダーは プログラマーが
-
subroutines, or procedures.
関数とか サブルーチンとか 手続きと 呼んでいるものの例です
-
No matter the terminology, the idea is the same—
どの名前で呼ぶにせよ 考え方は同じです
-
it's a set of instructions given a label so that it can be easily reused—
簡単に再利用できるよう 名前を付けられた一連の指示ということで
-
perhaps even by itself.
自分で自分を使うこともできます
-
And in our case that'll work perfectly—
この場面では ぴったりの方法です
-
an entire network of paths mapped using just three instructions.
たった3つの指示で すべての道筋を網羅できるのです
-
So here's what happens.
さて どうなるでしょう
-
By the time the patrol rounds the corner, Ethic and Lemma have improvised disguises.
警備の手がすぐそこに迫った時 エシックとレマは変装します
-
They try to confuse the bots long enough to buy Hedge time.
ロボットたちを混乱させて ヘッジのために時間稼ぎをするのです
-
Finally, Hedge's radio crackles to life with a series of directions.
ついに 無線でヘッジに 道順が送られてきました
-
The three dive onto the conveyor and flee for their lives,
コンベヤーに飛び乗って 命からがら逃げ出す3人を
-
with a squadron of enforcer bots in hot pursuit.
監視ロボットたちが 全速力で追って行きます