Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

1. Introduction to Setting and Randomness

Transcript

Welcome to Day 3 of CS First Storytelling! Today you will build a story set on a stormy day while you learn about two important computer science concepts: randomness and looping.

Computer scientists use randomness to generate numbers that don’t have a pattern. Imagine that you need to make a computer program that plays a simple game like rock, paper, scissors.

How would you program the computer to decide when to play rock? Or when to play scissors?

To program a game that is completely unpredictable, you need randomness!

Almost all video games are programmed with elements of randomness to make sure that players cannot make predictions. Imagine playing a game where you could always predict what would happen next. That wouldn’t be very much fun!

Randomness is also important to computer scientists who work in cryptography. Cryptography is what keeps digital communication safe from hackers who want to steal it.

The art of "being random." Now it sounds easy, but being random is actually really hard.

If you say to a computer "be random," it has a program to do that...

which is quite logical and not very random.

We have to look at other ways to get that stuff. So I went out on a little mission to build some of these devices.

I'm going to share one of them with you now.

I took a smoke alarm. A smoke alarm contains a lovely little radioactive source.

And nature provides these wonderfully random radioactive emissions.

So I took this, and using an incredibly expensive, high-tech containment device, I connected it to my computer with a Geiger counter and collected data from this wonderful source.

And the net result...

[noise] Okay, I'm the only one that's excited about that, right?

[laughter] To a cryptographer, that is brilliant! It's pure randomness!

Now, I'm taking all of these devices -- I built lots of them, some from vacuum cleaners and other strange things--- and plugging them into my website, where you'll be able to go online, and you'll be able to use these to generate some random data to make yourselves more secure online.

Cryptographers – people who do cryptography – ensure that when someone uses their credit card in a store, checks their bank account online, or even just stores personal information on a place like Facebook, only specific people can see their personal information. Cryptographers use randomness to generate really, really, ridiculously long, unpredictable passwords, called keys, that protect the messages computers send and receive. This project today will also introduce loops.

Loops allow computer scientists to program a computer to repeat a group of instructions.

The loops in Scratch are “forever” “repeat 10,” and “repeat until,” all of which are found in the “control” menu. Today’s story will require you to build a moving setting. The setting is the time and place where a story happens. It gives storytellers a chance to “set the scene” and tell the audience a little about what to expect from the story. Look at today’s example project. Imagine what type of story might take place in a rainy and stormy setting like this. Who would possibly be out in a storm like this? Are the characters doing something bad? Are they lost?

After programming the setting, you’ll create a story in this dark, mysterious place.

Right now, you’ll learn how to open the starter project, remix it, and sign in to Scratch. After watching this video, you’ll get the chance to try these steps on your own.

To begin, click the starter project link next to this video.

Click "remix" on the project page, and sign in using the information from your club pass.

Remember, if you don’t sign in, your project won't save.

In the next video, you’ll begin programming the rain to fall. Now, it’s your turn!

Open the starter project link next to this page.

Click remix, and sign in. Once you’ve completed these steps, click the CS First tab to switch back to this page, then click the green arrow to move on to the next video.

Next arrow_forward
Instructions
  1. Open the starter project link.
  2. Click remix.
  3. Sign in.