字幕表 動画を再生する
One thing that computers are really good at is repeating commands.
コンピューターは「くりかえし」がとくいです。
As a person, you'd get really bored if you had to do the same thing lots of times in a row.
にんげんは、たいくつしてしまいますが、
But a computer can do the same thing millions or even billions of times,
コンピュータは、なんかいでもくりかえせます。
and not get bored and be able to carry that out really well.
そしてコンピュータはまちがえもしません。
So for example if I wanted to wish
だから、たとえばわたしが
everyone on Facebook a happy birthday by sending them an email,
フェイスブックで「おたんじょうびおめでとう」の メールをみんなにおくろうとすると
it might take me more than a century to actually write out all of those emails to everyone.
100ねんかかっても、おわらないでしょう
But with just a few lines of code, I can have a system
でも、ほんのすこしのコードで、
send an email to everyone on Facebook wishing them a happy birthday.
みんなに「おたんじょうびおめでとう」と メールをおくれます。
So that's what loops are, and why they're valuable,
これが「くりかえし」です。
and something that computers can do very well.
「くりかえし」は にんげんよりもコンピュータがとくいです。
In this example your goal is going to be to move the bird
アングリーバードをミニオンピッグまでつれていきましょう
to get the pig. Now we're gonna be able to use the "repeat" block
「くりかえし」ブロックをつかって うごかしましょう。
in order to be able to do this very easily. You can either do this by
ふたつのうごかしかたがあります。
giving the computer a "move forward" command
ひとつめは「まえにすすむ」ブロックを
five times in order to advance the bird one step each time to the pig.
5つおくこと
Or you can just tell the computer to "move forward" once,
ふたつめは「まえにすすむ」をひとつおいて、
and then tell it to "repeat" that 5 times, and it will do the same thing.
「くりかえし」ブロックをおいて、 「5かい」くりかえすこと
So in order to do this you drag your "move forward" command,
まずは「まえにすすむ」ブロックをおいて
and then you put it inside the "repeat" block.
つぎに「くりかえし」ブロックでかこいます。
And you can click on it and tell it how many times you want to repeat the block
そして、5かいくりかえすと「めいれい」して
to tell it how many steps you want it to take forward. Now one more thing is
アングリーバードをうごかしましょう。
you can put as many commands as you want inside the "repeat" block.
「くりかえし」ブロックのなかには たくさんのブロックをおくことができます。
So in this example you're telling it to move forward and turn left,
こうすると、「まえにすすむ」と 「ひだりをむく」をくりかえします。
which it will do five times. Alright good job and have fun :-)
さぁゲームをたのしみましょう!