中級 278 タグ追加 保存
動画の字幕をクリックしてすぐ単語の意味を調べられます!
単語帳読み込み中…
字幕の修正報告
Upon emerging from stasis, Ethic is the unfortunate recipient of three surprises.
The first: a prison cell.
The second: complete amnesia.
And the third: a mysterious stranger has gotten stuck
squeezing through the bars on her window.
His name is Hedge, and he has come to help Ethic save the world.
But first they have to break out of jail.
Hedge turns his hand into a lockpick and outlines the challenge ahead.
Each lock in the prison works in the same unusual way.
Inside the keyhole is a red dial that can be rotated to one of 100 positions
numbered 1 through 100.
The key for a given cell spins the dial to the right position,
which, when stopped there, makes it turn green and unlocks the door.
It would be out of the question to steal keys from a guard,
but Hedge has a better idea.
Hedge can carry out Ethic's commands.
If Ethic tells him to walk 5 steps forward,
turn right, then walk another 5 steps,
that's exactly what he'll do.
Hedge needs specific instructions though.
If Ethic says “pick the lock” or “try every combination”
that would be too vague, but “spin the dial 5 positions forward” would work.
Once out of the cell, they will only have a few moments to crack the lock
for the outer prison door too before the guards catch them.
So what instructions will allow Hedge to efficiently open any door?
Pause now to figure it out for yourself.
Before we explain the solution, here's a hint.
A key programming concept that can help unlock the door is called a loop.
This can be one or more instructions that Hedge will iterate— or repeat—
a specified number of times,
like “jump up and down 100 times.”
Or an instruction that Hedge will repeat until a condition is met,
such as “keep jumping up and down until it's 7 o'clock.”
Pause now to figure it out for yourself.
The first thing that's clear is that you need to find a way for Hedge
to try every combination until one works.
What takes a little more effort is how exactly you do so.
One solution would be to instruct Hedge to try every combination in succession.
Try 1 and check the light.
If it turns green, open the door, and if not, try 2.
If that doesn't work try 3. All the way up to 100.
But it would be tedious to lay that out in its entirety.
Why write more than 100 lines of code,
when you can do the same thing with just 3?
This is where a loop comes in.
There are a few ways to go about this.
The lock has 100 positions,
so Ethic could say “Check the dial's color, then spin the dial forward once,
for 100 repetitions.
Remember where the dial turns green, then have Hedge set it back to that number.”
A loop like this, where you specify the number of times it repeats,
is called a “for" loop.
But an even more efficient loop
would have Hedge spin the dial one position at a time until it turns green
and as soon as that happens, have him stop and open the door.
That way if the door unlocks on 1,
he doesn't need to cycle through all the rest of the numbers.
This is an “until” loop,
because it involves doing an action until a condition is met.
A similar, alternate approach would be to turn the dial while it's still red,
then stop.
That's called a “while” loop.
Back to the adventure.
Hedge loops through the combinations, and the cell opens at 41.
Ethic and Hedge wait until the perfect moment in the guards' rotation
and make a break for it.
Soon, Ethic faces a choice: hide inside a mysterious crystal,
or try to crack the outer door and make a run for it.
Ethic chooses to run.
The second door takes Hedge longer, requiring him to spin all the way to 93.
But he gets it open
and takes the opportunity to explain why he's rescued Ethic.
The world is in turmoil:
robots have taken over, and only Ethic can set things right.
In order to do so,
they'll need to collect three powerful artifacts
that are being used for nefarious purposes across the land.
Only then can Ethic return to the world machine— that giant crystal—
to set things right.
Ethic may have escaped the prison…
but what has she gotten herself into?
コツ:単語をクリックしてすぐ意味を調べられます!

読み込み中…

The Prison Break | Think Like A Coder, Ep 1

278 タグ追加 保存
ktyvr258 2019 年 10 月 21 日 に公開
お勧め動画
  1. 1. クリック一つで単語を検索

    右側のスプリクトの単語をクリックするだけで即座に意味が検索できます。

  2. 2. リピート機能

    クリックするだけで同じフレーズを何回もリピート可能!

  3. 3. ショートカット

    キーボードショートカットを使うことによって勉強の効率を上げることが出来ます。

  4. 4. 字幕の表示/非表示

    日・英のボタンをクリックすることで自由に字幕のオンオフを切り替えられます。

  5. 5. 動画をブログ等でシェア

    コードを貼り付けてVoiceTubeの動画再生プレーヤーをブログ等でシェアすることが出来ます!

  6. 6. 全画面再生

    左側の矢印をクリックすることで全画面で再生できるようになります。

  1. クイズ付き動画

    リスニングクイズに挑戦!

  1. クリックしてメモを表示

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