The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by eddylia83, 2021-02-14 08:38:25

HOW TO BE A CODER LEARN

HOW TO BE A CODER LEARN

Keywords: CODER

The program

This program challenges you to press the space bar
when you think the crab is touching the edge of the
stage. Take a good look and see if you can identify
the conditionals and the conditions in the code.

when clicked This condition means the
code in the conditional will
go to x: 0 y: 0 keep running until the
space bar is pressed.

repeat until key space ▾ pressed?

go to x: pick random -200 to 200 y: pick random -200 to 200

wait 1 seconds Each time the code
runs, this block picks a
if touching edge ▾ ? then random position for the
sprite to appear in.
say You win! for 2 seconds
This condition asks
whether the sprite is
touching the edge of the
stage, but the program will
never get to it unless the
space bar is pressed.

If the sprite is touching the edge,
then the “touching edge?” condition
is true and the sprite will say this.
Otherwise, the program will end.

You win!

1 The sprite will move randomly around the stage 2 If you stop the loop while the sprite is touching
until you press the space bar. the edge, you win!
99

If/else

It’s great to be able to run a set of code if a
condition is true, but it’s even better to be able to
run a different set of code if it’s not! That’s why we
have if/else blocks. An if/else block is a type of
conditional that will let you tell the computer what
to do whether your condition is true or false.

The program when clicked

Here is some code that will make a sprite
dance whenever you press the space bar, by
flipping it from left to right. A “forever” loop
makes the “if then else” block keep checking
to see if the sprite should flip.

go to x: 0 y: 0

The “forever” loop around the point in direction 90 The “if then else” block
“if then else” block makes the set rotation style left-right ▾ checks if the condition
program keep checking whether forever “key space pressed?” is
true or false.
the space bar is pressed.

If the “if then else” if key space ▾ pressed? then
block finds the “key space point in direction -90
pressed?” condition true, the
sprite will face to the left. else
point in direction 90
If the “if then else”
block finds the “key

space pressed?”
condition false, the

sprite will face to
the right.

100

The “if then else” if then Any code added here
block else will run only if the
A condition can condition is true.
The “if then else” block is a be added here.
conditional, but unlike the “if then” Any code added here
or “repeat until” conditionals, it holds will only run if the
two sets of code. This means you condition is false.
can ask the computer to do different
things depending on if your
condition is true or false.

i
Useful tip

Don’t forget to add code to position your sprite
properly at the beginning of each program. If you

don’t, you might have settings left over from
previous code that makes the sprite do
something that you didn’t want.

1 Your sprite will start by facing to the right, but 2 If the space bar isn’t pressed, the sprite will stay
if you press the space bar it will flip to the left. facing the right. If you keep pressing and releasing
the space bar, the sprite will dance on the spot.

101

Events

Up to this point, we’ve only started actions when
the green flag is clicked. However, that is only one
type of event used to trigger a piece of code. You can
use different events to make a game more fun by
starting actions while a program is already running.

Types of event

Event blocks make certain sections of code
run when something special happens. For
many programs, the code runs when the
green flag is clicked, but code can also be
run after a set amount of time, when you
click on a sprite, when you press a certain
key, or when another event happens.

when clicked

This block lets you start running the code
connected to it by clicking the green flag
on top of the stage.

when this sprite clicked when timer ▾ > 10

When you click on a certain sprite, this event When a timer gets above 10, or another value of your
block runs the code attached to it. choice, the code connected to this block will run.

when space ▾ key pressed when backdrop switches to backdrop1 ▾

The code connected to this block will run only This block will run the connected code when the backdrop
when the space bar is pressed. of your program is coded to change to a different picture.

102

This event block starts the dog The program
running around the screen.
You can use more than one event block in
when clicked the same program to make different things
happen. Here’s the code for a game where
forever you have to catch a running dog or make it
bark. Can you figure out how to play?
wait 0.5 seconds
y: pick random -100 to 100
go to x: pick random -100 to 100

The dog will appear
in random positions
around the stage.

This event block will make the dog
bark when you press the space bar.

when space ▾ key pressed Woof!
say Woof! for 2 seconds

This event block makes the dog say 1 The sprite will run around until you press the space
“You got me!” when you click on it. bar. This will make it bark.

when this sprite clicked
say You got me! for 2 seconds
go to x: 0 y: 0
stop all ▾

Now try... You got me!

Once you figure out how the game works, 2 If you click on the sprite, it will say “You got me!”
change the speed that the sprite moves around and the game will end.
to make it harder. Make the game extra special 103
by adding code so the background changes
when the up arrow is pressed!

Input/ Permissions
output
This program requires the use of a webcam.
When you click on a sprite Scratch needs your permission to use input
using your mouse, or press a from your webcam. When you click on the
key on your keyboard, you are Video Sensing option, a pop-up window will
providing your computer with ask you to allow or block it. You will only be
input. These inputs affect the able to try this program if you click allow.
outputs from your screen or
speakers. You can even use Scratch.mit.edu wants to x
input from a webcam to make
your programs interactive! Use your camera Allow

Block

The program

In this program, you try to catch Sprite 2
using Sprite 1, but you control the sprite
by waving your arms around!

1 This script will make a sprite move
around the screen until it touches
the other sprite.

when clicked This will change the size of your
sprite. You can adjust it to make
it bigger or smaller.

Sprite 2 set size to 80 % Once you have created a
second sprite, there will be
Make sure you’ve clicked go to x: -200 y: -200 an option in the drop-down
on the Sprite 2 icon menu here to select Sprite 1.
before creating repeat until touching Sprite 1 ▾ ?
this code.

turn pick random -2 to 6 degrees
move 8 steps
This block will make
your sprite move
around the stage.

104

2 The script here lets you control the second i
sprite with movement. The sprite will move Useful tip
in the direction of the motion on the webcam.
If you find you’ve written your
Sprite 1 Make sure you’ve clicked code for the wrong sprite, don’t
on the Sprite 1 icon before worry—you don’t have to write it
creating this code. all again. Drag the section of code
you’ve already made onto the
when clicked correct sprite icon underneath the
stage and those blocks will be
go to x: 0 y: 0
copied over to that sprite.

set size to 80 %

turn video on ▾ This block will let you see yourself
set video transparency to 50 on the stage, but slightly faded so
you can still see the sprites, too.

repeat until touching Sprite 2 ▾ ?

point in direction video direction ▾ on sprite ▾

move 5 steps This block makes
say You got it! for 2 seconds Sprite 2 turn toward
any movement on
the stage.

turn video off ▾ Don’t forget to add code to
turn the camera off once
Sprite 1 catches Sprite 2.

You got it!

Sprite 2 will move
around the stage
constantly.

1 Sprite 2 will keep moving around the stage. You 2 Try to make Sprite 1 catch Sprite 2. Once it has,
move Sprite 1 by creating motion on the webcam. the program will end.
105

Collisions Make a collision

When a sprite runs into the edge of Collisions are recognized in
the stage, or another sprite, that’s a Scratch by “touching” condition
collision! A collision happens whenever blocks. If you want to check
two objects touch. In some games, you whether two things are colliding
want two objects to collide, but in at a specific moment, or if you
others you want to avoid collisions! want to have something happen
any time two things collide, put
the “touching” block inside a
conditional block.

touching edge ▾ ?

This condition asks if
the sprite is touching
the edge of the stage.

The program 1 This code makes a dragon
move across the screen until
In this game, a princess has to avoid a horde of it hits the edge of the stage.
dragons! Can you help her escape them? First, we The dragon then deletes
need to make a flying dragon that copies, or “clones,” itself, but makes a new
itself when it goes off the edge of the stage. That dragon start at the beginning.
way we don’t have to keep making new sprites.

Sprite 1 Make sure you select Sprite 1 when I start as a clone The code attached to this
before you create this code. If you show control block will run for all
draw your own, it might be useful the clones of the dragon.
to label it “Dragon” so it will be
easier to select later.

go to x: 200 y: pick random -100 to 100

when clicked forever These blocks will make each
move -6 steps sprite start at a random height
hide on the right of the stage.

create clone of myself ▾ if touching edge ▾ ? then

This block will create create clone of myself ▾
a clone of Sprite 1.

delete this clone

This block deletes the clones
that fly away so that they don’t
pile up at the edge of the stage.

106

2 This code lets you control the princess, i
but also makes her say “Ouch!” or “Oops!” Useful tip
if she collides with a dragon or with the
edge of the stage. In order to select another sprite from the
drop-down menu in the “touching” blocks,
Select Sprite 2 before they must already be added to the Sprite List.
creating this code. Make sure you add all the sprites you want

Sprite 2 before you start writing your code.

when clicked

show Sprite 2 starts on the The code sets Sprite 2’s
point in direction 90 left of the stage. size to 80%. You can play
go to x: -100 y: 0 around with that number
set size to 80 % This line adds gravity to see what size is the
forever to your game, making most fun!
Sprite 2 fall a little all
change y by -3 the time.

if touching Sprite 1 ▾ ? then Ouch!

say Ouch! for 1 seconds

hide

stop all ▾ If the princess collides
with the dragon, the
game is over.

if touching edge ▾ ? then

say Oops! for 1 seconds

hide
stop all ▾

when space ▾ key pressed Oops!

change y by 40 This bit of code moves The game will also
Sprite 2 toward the top end if the princess
of the screen. You need collides with any of
to keep pressing the space the stage’s edges.
bar to stop her from falling.
107

Variables

Sometimes you need to keep track of things that
change in a program or game. You can do this using
variables. A variable is a placeholder that can be
used for a value, even if the value changes while
the program is running. Variables are really useful
for keeping score in a game.

Create a variable block

You can create your own variables in Scratch. Here’s how
to create a variable to keep track of the score in a game.
You’ll find what you need in the Variables section.

Code Costumes Sounds Code Costumes Sounds

Motion Variables Go to the Motion Variables
Looks Variables Looks
Make a Variable section and click Make a Variable
my variable on the Make a my variable
Variable button.
Sound set my variable ▾ to 0 Sound score

Events change my variable ▾ by 1 Events set my variable ▾ to 0
Control show variable my variable ▾
Sensing hide variable my variable ▾ Control change my variable ▾ by 1

Operators New Variable Your new variable will You can set the value of your
Variables now appear in the list. variable using the “set to”
My Blocks New variable name: block. Select your variable
score A box will pop up and from the drop-down menu.
you will need to name
For all sprites For this sprite only your variable “score.” set score ▾ to 0
Make sure “For all
sprites” is selected. my variable
score
More Options ▾ OK Rename variable
Cancel Delete the “score“ variable

108

The program when I start as a clone
set size to 30 %
In this game, we’ll make hearts keep
falling down. A variable will make the go to x: pick random -150 to 150 y: 150
score go up if a llama catches them
or down if the llama misses them. forever Choose Sprite 2 from
change y by -8 the drop-down menu.
1 This code makes a heart sprite
move across the stage. It will if touching Sprite 2 ▾ ? then
add 1 to the score if it touches
the llama or -1 if the heart gets change score ▾ by 1 This block will add
to the bottom of the stage. create clone of myself ▾ a value of 1 to your
delete this clone variable every time
Sprite 1 Sprite 2 touches
Sprite 1.
When you
when clicked start the
program, the
set score ▾ to 0 score will be if touching edge ▾ ? then
set to 0. change score ▾ by -1
create clone of myself ▾ This block will
show delete this clone minus a value of 1
from your variable
create clone of myself ▾ every time Sprite 2
misses Sprite 1.
hide

2 These blocks of code let you
move the llama left and right.

when clicked Your variable “score” will
appear in the top left of
Sprite 2 set size to 55 % the stage.

go to x: 0 y: -100 score 5

point in direction 90

when right arrow ▾ key pressed This code will
move 15 steps move Sprite 2
right when you
click the right
arrow.

when left arrow ▾ key pressed This code will
move -15 steps move Sprite 2
left when you
click the left
arrow.

109

Satoru Iwata

Video-game programmer • Born 1959
• From Japan

Satoru Iwata always loved playing video games.
From an early age, he was fascinated with how
games were created and developed. He went on to
become president of Nintendo, a worldwide video
game and electronics company based in Japan.

Early training

Iwata was still in school when he
created his first video game! He
made it on a programmable calculator.
Iwata went on to study computer
science at the Tokyo Institute of
Technology. It was there that he
learned the skills he needed to
develop programming for games.

Nintendo

Iwata helped to program many games for the video-game
maker Nintendo. In 2002, he became the fourth president
of Nintendo, and he helped launch several new consoles,
such as the handheld Nintendo DS and the Nintendo Wii.

110

Pokémon GO

Iwata was involved in the creation of
Pokémon GO—a mobile game where
you catch virtual reality creatures
called Pokémon. Developed by
Nintendo, Niantic, and The Pokémon
Company, the game uses a phone
camera to make Pokémon appear
as if they are in the real world.

Iwata Asks

Iwata hosted video interviews with Nintendo
programmers about Nintendo games,

hardware, and the coders themselves. This
series of videos, called “Iwata Asks,” taught

fans about how games were created.

Nintendo DS

One of the most popular Nintendo consoles
was the handheld Nintendo DS. Iwata oversaw
its release in 2004. The DS was unlike previous

handheld devices in that it had a split screen
and worked using a touchscreen and stylus.

111

Functions

What do you do when you want to run the same bit of
code several times but you want to do something else
in between? Then it’s time for a function! Functions let
you name a special section of code that you want to
use later. Then, when you want that code in a program,
you can just use your named block!

Make a function block To complete your function, add
the code that you want below
As with a variable, you have to create a function block the “define” block. You can then
before you can use it in a program. The code for a function use the block in your program.
has two parts: the definition block and the name block. You
can make a function in the “My Blocks” section. Here, we’ll define draw a triangle
create a function that makes a sprite draw a triangle.

Code Costumes Sounds You can find the pen down
pen tools in Add
Motion My Blocks Click on Make Extension. repeat 3
Looks Make a Block a Block and a
Sound pop-up window Give your function a move 70 steps
draw a triangle will appear. name that describes it so
that you can remember
what it does when you turn 120 degrees
want to use it later.
Events

Control Make a Block pen up
Sensing Block name
Operators
Variable when clicked
My Blocks
text draw a triangle
Pen Add a label
Add an input Add an input
number or text boolean

Run without screen refresh

Cancel OK

When you have named
your block, click OK.

112

The program This is your triangle,
drawn 12 times in a circle.
Functions are useful when you need to
repeat any section of code more than once,
but they are really powerful when you use
them several times in the same program.
Here, we will use the triangle function over
and over to make some beautiful designs.

when clicked

erase all Make sure to clear
the stage before you
go to x: -80 y: 0 start so that you have This is the same triangle,
point in direction 90 a blank canvas. drawn 8 times in a circle.
repeat 12
Add your function to Now try...
set pen color to draw a triangle shape.
What other drawings
draw a triangle There are 360 degrees in a can you make with your
turn 30 degrees circle. As the loop repeats triangle? What happens
12 times, you want each if you change the number
go to x: 80 y: 0 triangle to be drawn a farther of repeats and how many
repeat 8 30 degrees around, as there are degrees the triangle turns
12 times 30 degrees in 360. in the program?

set pen color to

draw a triangle
turn 45 degrees

go to x: -200 y: -200

This block will move the sprite
out of the way so that you can
see your finished creation!

113

pFuancrtaiomns ewtiteh rs

What happens when you want to do something over and
over, but not in exactly the same way every time? Then
you need a function that you can change—a function with
parameters. Parameters are a kind of variable that make
your function work differently in different situations.

Make a function Add the code below to the “define”
with parameter block block so it can draw a square.

We are going to make a block called “draw a square.” define draw a square size
Select Make a Block and name your function, then
select “Add an input” and name the input “size.”
This input will be our parameter and it will change
the size of the square.

Code Costumes Sounds pen down To add the “size”
block to the “move
Motion My Blocks repeat 4 size steps steps” block, drag a
Looks Make a Block move copy of it from the
Sound “size” part of the
Make a Block above function.

turn 90 degrees

Events draw a square size

pen up

Add an input Add an input text
number or text boolean Add a label

Run without screen refresh draw a square 50

Cancel OK When you use your “draw a square”
function, there is a space for you to
Click “Add an input” to add a fill in a value for the parameter “size.”
parameter to your function.

114

The program when clicked

Now we are going to use our function erase all
with parameter block to make a pattern
of different squares with variable go to x: -30 y: 90
sizes. Each time we want to make a
new square, all we have to do is use point in direction 90
our function and add the size of
the square that we want to draw. repeat 10

draw a square 20 This function with
parameter block
move 60 steps draws a square with
sides 20 pixels long.
draw a square 55
This function with
turn 36 degrees parameter block
draws a square with
The sprite turns 36 degrees go to x: 0 y: 0 sides 55 pixels long.
for every repeat. Since there
are 360 degrees in a circle, the repeat 9 This moves the sprite
loop needs to repeat 10 times. to a new position to
start drawing a second
This code draws three different-sized circle of squares.
squares. Instead of making three
different functions, though, you only draw a square 30
need one function with a parameter.
turn 40 degrees

go to x: -200 y: -200

Now try...

Try changing the value
of the parameter “size”
and see what happens
to the pattern. How big
a square can you make?
How small a square can
you see?

115

Decomposition

Even if you know what you want your program to do, it’s not
always clear what blocks you’ll need or how you will get the
computer to complete the actions you want. That’s why you
need decomposition. When you decompose a problem,
you break it down into smaller pieces to see more easily
how to program each part.

The algorithm

Here’s an algorithm for a program that takes words
and spells them backward. It needs to be broken
down further before it can be coded. Can you
identify which steps can be done with a single block
and which parts might need to be decomposed?

Start Ask user Spell This part of the algorithm
for their the word will require some more
favorite backward complicated code.
animal

This can be done Ask user Spell End
in Scratch using for their the word
a single block. favorite backward
food
This step will only
need one block in This part of the algorithm
your code. appears twice, so it might
be useful to make a
function to do it.

116

Decomposing your algorithm

There isn’t a single block in Scratch that spells a word
backward, so this step would benefit from decomposition.
Think about this step and what smaller steps within it
need to happen. Also, since the step appears twice, you
could make a function with parameters to save time later!

Start

Ask user Pass the answer You can use the
for their into a function answer to both
favorite called “spell questions as a
animal backward” parameter in a
new function.
This step can be Spell The function
broken down into the word counts how A variable can store
smaller steps. How backward many letters the number of letters
many smaller steps the answer has in the word.
will you need?
Sprite repeats The sprite will need
letters for that to say the same
number of times number of letters
as in the answer.
Ask user Sprite says the
for their letter at the The sprite needs to
favorite variable’s position say each letter.
food
Subtract 1 from After one letter is
This step does Spell the variable said, the sprite needs
the same thing as the word to say the previous
before. Can you backward Return letter in the word.
make a function to main
with parameters End program Once the function
that works for both? has run, the code
should return to
the program.

117

Making new blocks Code Costumes Sounds

The decomposed steps need both a Motion My Blocks
variable and a new function. You can Looks Make a Block
create those in the Blocks Palette under Sound
Variables and My Blocks. Make sure to Make a Block
name everything in a way that reminds
you what your blocks are used for.

Events spell backward word

Code Costumes Sounds

Motion Variables This variable will keep Add an input Add an input text
track of the letters in number or text boolean Add a label
Make a Variable each answer.

Looks my variable Run without screen refresh

Cancel OK

Sound number of letters

Events Don’t forget to add a parameter to
your function so the user can add
a word into the code.

Defining your function

Now you need to tell your function what to do
when it’s time to spell a word backward. Try to
match the decomposed steps to each block of code.

define spell backward word In order to place the “word” block
into the code below, drag it across
from the “define” block.

set number of letters ▾ to length of word

say Backward, that’s spelled: for 1 seconds This Variable block takes the
parameter “word” and counts
repeat number of letters the number of letters in it.

say letter number of letters of word for 0.5 seconds

change number of letters ▾ by -1 Every time the code says a
letter, it takes 1 away from the
The “repeat” loop will make the variable, so on the next repeat
program keep saying letters until the it says the letter before.
variable gets to 0. This happens when
the whole word has been spelled out.

118

The program when clicked This Sensing block makes
the program wait until the
Now you can build the user has typed an answer.
whole program. When
it runs, the sprite will ask What’s your favorite animal? and wait This block will call
ask the user to enter the function that you
answers that can then spell backward answer defined earlier using
be spelled backward. the answer from the
question above it.

ask What’s your favorite food? and wait

spell backward answer

Your variable value will
show here if the box
beside the variable in the
Blocks Palette is checked.

numLetters 0 numLetters 5

What’s your favorite animal? Backward, that’s spelled:

This box appears
automatically when you
use an “ask” block.

1 First, the program will ask the user for their 2 The program counts the number of letters in your
favorite animal and a box will appear. Type your answer. If you picked “horse,” which has five
answer in and click on the check mark. letters, you will see “5” appear on the stage.

numLetters 3 Watch the variable numLetters 0

value count down What’s your favorite food?
each time the
r loop runs. The sprite will now
spell your favorite
The sprite will food backward.
say each letter
one by one.

3 The sprite says each letter of the word from last to 4 Once the function has run, the code returns to the
first. It stops when the variable gets to 0. main program and asks you the next question.
119

The program when clicked

These scripts make a sprite change costume, go to x: 0 y: 0
color, and size. However, the program is much
longer than it needs to be. Take a look at it and point in direction 90
see if you can find any repeating patterns that
you could replace with a function. switch costume to costume1 ▾

when space ▾ key pressed set size to 100 %
go to x: 0 y: 0
point in direction 90 clear graphic effects
switch costume to costume1 ▾
set size to 100 % wait 2 seconds
clear graphic effects
wait 2 seconds forever

when this sprite clicked go to random position ▾
go to x: 0 y: 0
point in direction 90 if touching edge ▾ then
switch costume to costume1 ▾
set size to 100 % change size by -20
clear graphic effects
stop all ▾ turn 15 degrees

Pattern change color ▾ effect by 25

else
change size by 20

turn 37 degrees

next costume
wait 0.5 seconds

matching

Sometimes pieces of code that work for one thing will also
work for other similar programs. Looking for patterns in
scripts can help you find code that can be reused or made
into a function that you can use whenever you need it.

120

Make a function Define the “reset”
function by adding all
There are three places in the scripts where the code that repeats
the sprite is sent back to the center of the in all three scripts.
stage, turned the right way, and reset to
its original costume, size, and color. Can you
see where? They can all be replaced by a
single function.

Code Costumes Sounds define reset

Motion My Blocks Make a new go to x: 0 y: 0
Looks Make a Block block that point in direction 90
Sound will hold the switch costume to costume1 ▾
reset reused code. set size to 100 %
clear graphic effects
Events Name the block
something that
Control will remind you
what it does.

Sensing Make a Block All these blocks are
Operators Block name repeated in the same
order in the scripts.
Variable

My Blocks

Add an input Add an input text
number or text boolean Add a label

Run without screen refresh reset

Cancel OK

Press OK when All three scripts can
you’re done. now start with the
new function.

Now try... define reset location

What if you don’t want to position
your sprite in the center each
time? Can you add a parameter
to your “reset” function so that
you can start your sprite in a
different location each time you
use your function?

121

Three functions This function sets the sprite to a color
effect of 150 and a size of 150%.
Before you create the program, make
these three functions in Scratch. Each define big
one sets the sprite to be a different set color ▾ effect to 150
size and color. set size to 150 %

Code Costumes Sounds This function sets the sprite to a color
effect of 75 and a size of 75%.
Motion My Blocks
Looks Make a Block define medium
Sound set color ▾ effect to 75
Events big set size to 75 %
medium
small This function sets the sprite to a color
effect of 50 and a size of 50%.
Control Create the three new
Sensing functions in the My Blocks
section of the Blocks Palette.

Operators

Variable

My Blocks

The sprite starts as one define small
color and size, which the
functions change. set color ▾ effect to 50
set size to 50 %

Abstraction

When you look at something that has too much detail, you
can lose the big idea underneath. In this program, we’ll give
you three different functions. Your job is to take away the
unnecessary details that could be added as parameters later.
Making code simpler like this is called abstraction.

122

The program First the sprite
grows bigger, then it
The program makes the sprite big, then shrinks to be small.
small, then medium-sized, and changes
its color each time.

1

The functions here change the size
and color of the sprite, with pauses in
between each change so you can see
them happen.

when clicked

big

wait 1 seconds The “wait” blocks
make the code slow
small enough for you to At the end the
see the color and sprite grows to be
wait 1 seconds size changes.
medium-sized.

medium

2 define abstracted function change

You don’t really need three set color ▾ effect to change Remember you can drag
separate functions to make set size to change % the “change” parameter
the program work—and here directly from the
functions take time to make. when clicked “define” block above.
Instead, you can make one
function with parameters! abstracted function 150 Now you can use the
wait 1 seconds same function to add
in the size and color
abstracted function 50 change effect values
wait 1 seconds you want.

abstracted function 75

123

Bill Gates

Programmer and businessman By the 1990s, Microsoft’s
• Born 1955 • From the USA Windows operating system
had become the preferred
Bill Gates is the cofounder of the world- choice for PCs.
famous computer company Microsoft.
Gates learned to code at an early age
and went on to create hugely successful
software. Today, he and his wife are
well-known for the charity work they do.

Early training BASIC for Altair 8800

It was not common for schools to have One of the most popular personal
computers when Gates was young. He computers (PCs) in the 1970s was the
was lucky enough to have access to one
and wrote a computer program to play Altair 8800. Gates and his childhood
tic-tac-toe on it. He used an early version friend Paul Allen created a program
of BASIC, a programming language that called a compiler that allowed the
was popular at the time. Altair to be programmed with BASIC.

124 Altair 8800
computer

Micro-Soft

Bill Gates and Paul Allen found great success
with Altair BASIC. They continued to develop
computer software under the name Micro-Soft,
which later became Microsoft. They also created
operating systems, which are the programs that
make computers work. The operating system
Microsoft Windows is now used around the world.

There have been
many versions
of the Windows
operating system.

Harvard University

After high school, Gates attended Harvard
University in Massachusetts, where he

studied both mathematics and computer
science. He chose to drop out of Harvard,

however, so he could concentrate on
making and selling software.

Charity work

In 2000, Bill Gates and his wife, Melinda,
set up a charity called the Bill & Melinda

Gates Foundation. Its goals include
improving education and health, particularly

in poorer communities. Bill and Melinda
received the Presidential Medal of Freedom
for their work. This is one of the top awards

given to US citizens who have made an
important impact on society.

Bill and Melinda Gates were awarded the Presidential Medal
of Freedom by US president Barack Obama in 2016.

125

Remixing 1 The program draws a cluster
of three stars when one sprite
When you remix a project, you is touched. Two functions are
take something that’s already needed to create this effect.
been created and change it or
add to it so that it works better Sprite 1 Make sure you’ve clicked
for you. Remixing can be a form on Sprite 1 before
of collaboration or it can be a way creating this code.
to add variety to a project that
you have made yourself. The first function draws a star
shape. It has a parameter so you
can draw stars of different sizes.

define draw a star size

The program pen down

Here is a program that lets you move sprites repeat 5
around and create patterns using a webcam. move size
Can you use the skills you’ve learned in this turn 144 degrees
book to remix the program and make it even
better? pen up

This function uses the first to draw three
stars next to each other, all of different sizes.
Try changing the values to remix the pattern.

Code Costumes Sounds

My Blocks define star cluster
Make a Block
Motion draw a star 30
Looks draw a star size
Sound turn 15 degrees
Events star cluster
Control move 30 steps
Sensing The program uses
two functions, one draw a star 50
with parameters.
turn 80 degrees

Operators move 40 steps

Variable draw a star 15

My Blocks turn 65 degrees

126

when clicked Permissions

turn video on ▾ This program requires the use of a webcam.
Scratch needs your permission to use input from
set video transparency to 50 your webcam. When you click on the Video
Sensing option, a pop-up window will ask you
erase all This clears the to allow or block it. You will only be able to try
pen up stage when the this program if you click allow.
program starts.
Scratch.mit.edu wants to x

go to x: -100 y: 0 Use your camera
set size to 40 %
Block Allow

forever

if video motion ▾ on sprite ▾ > 20 then

pen up If the sprite senses motion
on the webcam, it will jump
go to random position ▾ to a random position and
star cluster draw a star cluster.

go to x: pick random -200 to 200 y: 0 A value of 0 for y means
the sprite will always
point in direction 90 return to the center line
of the stage.

1 The sprite appears in the middle of the screen and 2 This sprite jumps around the stage and leaves a
only moves when you touch it. star cluster pattern in every place it goes.
127

2 The second sprite in the program Sprite 2
makes a stamp of itself in a different
size each time you hit it. You could Make sure you’ve clicked
remix it to make more or fewer stamps, on Sprite 2 before
or to change its color every time. creating this code.

when clicked

go to x: 100 y: 0 Change the size of the The sprite will only make a
set size to 100 % sprite if you want to. stamp if it senses enough
forever motion on the webcam.

if video motion ▾ on sprite ▾ > 20 then

pen up

go to random position ▾ Make sure to pick a
next costume sprite with more
than one costume.

set size to pick random 10 to 200 %

set ghost ▾ effect to 50 This will leave The “ghost” effect
stamp a copy of the will make the sprite
sprite’s image a little see-through
set ghost ▾ effect to 0 wherever you before it stamps.
set size to 100 % use it.

go to x: pick random -200 to 200 y: 0

After making a stamp, the i
sprite will return to the Useful tip
center line of the screen.
Whenever you create a program that makes a
sprite change costume, make sure you’ve picked
a sprite that has more than one costume already.

Alternatively, you can make extra costumes
for the sprite yourself.

128

3 The final sprite deletes everything Sprite 3 Make sure you’ve clicked
on the screen when you collide on Sprite 3 before
with it. This one will clear the creating this code.
screen when it gets too messy.

when clicked

go to x: 0 y: 0 A “forever” block means the following
set size to 70 % code will run anytime you collide with
forever the sprite, not just the first time.

if video motion ▾ on sprite ▾ > 20 then

pen up

go to random position ▾

erase all This sprite will delete all the star clusters
and stamps on the screen when it is touched.

go to x: pick random -200 to 200 y: 0

point in direction 90

3 Move your hands over the first two sprites to make them Now try...
draw patterns, or touch the third sprite to clear the stage.
Don’t forget to remix the
code and add extra sprites
and effects to make the
game more fun!

129

Minicomputers DIY robot

Minicomputers have the same Marty is a robot that comes in a
basic parts as computers many kit to be made at home. It can
times their size, but these tiny be controlled by a Raspberry Pi
devices are small enough to fit in using the programming languages
the palm of someone’s hand. Despite Scratch, Python, or JavaScript.
their small size, they have all of the Marty can be programmed to
features that you need to create walk and dance.
amazing things—such as a robot!

micro:bit These chips might Battery pack connectors
seem tiny but they’re let you play the games
The micro:bit has built-in LED lights and buttons. very powerful. you make anywhere!
Once it is programmed, you can play games on it
without any extra attachments.

Buttons on the micro:bit 25 LEDs can be programmed These copper connections let
allow you to give it input to display letters, numbers, you attach and program other
while a program is running. or pictures. devices, such as a speaker.

130

Raspberry Pi Two USB ports are used to
connect devices, the same way
A Raspberry Pi can be used to program anything from you would connect devices
a touch-screen tablet to a humanoid robot, depending to your home computer.
on which pieces of hardware are attached to it.

Input and This little chip is in charge
output pins of the USB ports, as well
let you add as the ethernet port.
hardware.
The Raspberry Pi has
A power built-in Wi-Fi, but it also
supply comes with an ethernet
can be port so you can connect
connected to the internet with
by micro a cable.
USB.
The audio jack
Arduino connection and HDMI
slot allow you to connect
An Arduino, like a micro:bit, is programmed screens and speakers.
using another computer. They can only
store a single program at a time. There are 14 digital pins
that let you connect input
and output devices.

Uno is just one type
of Arduino.

The Arduino connects This board lets you
to a computer with a choose multiple
USB cable to program power options,
it the way you want it. depending on the
power that your
The barrel jack devices need.
connection lets
you connect a 131
battery and run your
programs without
access to electricity.

How to connect micro:bit The program

In order to use Scratch to program a micro:bit, you This program will make your micro:bit into
need to do a couple of things before you start. This a controller for a game in Scratch. You will
section will tell you what you need to know. be able to use the buttons to make the
sprite jump. The micro:bit will even display
Requirements: Bluetooth Scratch your score!
4.0 Link
Windows 10 version 1709+ 1 First, we’ll code our main sprite.
or mac OS 10.13+ These scripts will reset the
game when you start it, define
1 Install Scratch Link and micro:bit HEX how you win or lose, and let
Ask an adult for permission to download you control the main sprite.
and install Scratch Link and micro:bit HEX.
Both applications can be found at: Make sure you’ve clicked

https://scratch.mit.edu/microbit on Sprite 1 before
Follow the instructions provided.
creating this code.
Sprite 1 You need

2 Connect micro:bit to Scratch define to create a
Make sure the micro:bit is still connected to
your computer via the USB cable in order variable called
to begin programming it.
“score” before

reset you can add

this code.

3 Add the micro:bit extension go to x: -100 y: 0
When you open Scratch, add the micro:bit point in direction 90
extension to the Blocks Palette. set score ▾ to 0

display text score

micro:bit set size to 55 %

Scratch has special blocks that let define endGameWin
you write code for other devices,
such as the micro:bit. The micro:bit say Yay! for 1 seconds
is a minicomputer that has buttons stop all ▾
and lights built into it. You can use
it to create fun games! define endGameLose

132 reset You will need to make
stop all ▾ and define three
different functions
to make this game.

when A ▾ button pressed when B ▾ button pressed
change y by 50
reset When the A button is pressed,
forever we want the game to reset The micro:bit is
and begin again. a controller that
makes your sprite
change y by -3 jump or restarts
the game.
if touching edge ▾ ? then

endGameLose

if score >4 then
endGameWin

when I start as a clone
show

go to x: 150 y: pick random -150 to 150

2 Next, we need to set up forever We want each clone to keep going
a “bad” sprite that our main change x by -10 until it collides with Sprite 1 or
character is trying to avoid. the edge of the stage.

Make sure you’ve clicked if touching Sprite1 ▾ ? then
on Sprite 2 before
Sprite 2 creating this code. change score ▾ by -1
create clone of myself ▾
when A ▾ button pressed delete this clone If the two sprites
go to x: 200 y: 200 collide, you will
set size to 50 % lose a point.

hide if touching edge ▾ ? then
create clone of myself ▾ create clone of myself ▾
delete this clone A new clone will appear
We will need a lot of copies when Sprite 2 hits the
of Sprite 2. It’s easier to make edge of the stage.
clones than lots of sprites.

133

3 Finally, we need to write the code for the when A ▾ button pressed
sprite that you want your main sprite to try go to x: -150 y: 150
to catch to increase your score.

create clone of myself ▾

Make sure you’ve clicked on Sprite 3 hide The original sprite should
before creating this code. hide after it creates a clone.

Sprite 3

when I start as a clone There will be a lot of copies of The micro:bit LEDs will
show Sprite 3 in this game. Since they display your score.
all do the same thing, they can be
clones rather than new sprites.

go to x: 150 y: pick random -150 to 150

forever then
change x by -10
if touching Sprite1 ▾ ? When Sprite 1
hide catches the clone,
change score ▾ by 1 you will get a point.

display text score Your “score” variable shown
here should match what’s
create clone of myself ▾ displayed on the micro:bit.
delete this clone

if touching edge ▾ ? then score 4
hide
create clone of myself ▾ The sprite will jump
delete this clone by 50 pixels each
time you press the
B button.

Whenever a clone touches the edge The clones will keep
of the stage, it should disappear and flying across the screen
create a new clone. until the game is over.

134

Answers 8
7

6

5

17 Paper pixels 21 Debugging drawings 4
Here is what your finished The correct instructions for Box 4 3

pixel image should look like. should read: Go diagonally up to 6,6 2

It’s a dinosaur! then across to 5,6 and then diagonally 1
to 3,8. Go to 3,6 and then diagonally
0
down to 1,5. Finish at 0,7.
0 12 3 4 5 6 78

57 Parameter path
This is how to complete

the maze. The finished

program should look like

56 Parameter path the blocks below:
This is how to complete the maze.

The finished program should look

like the blocks below:

moveDown(3) 63 Pattern matching creepy-crawlies
moveLeft(4) These are the things each set of
moveDown(2)
moveRight(2) moveRight(3) creepy-crawlies has in common:
moveDown(3) Repeat 2 times
Repeat 2 times Arachnids Insects
moveDown(5)
moveLeft(2) moveRight(1) Which of these things do Which of these things do
moveDown(3) they have in common? they have in common?
moveDown(2)
moveLeft(5) moveRight(2) Eight legs Two antennae
moveUp(1) moveUp(3) Wings A furry tail
moveLeft(3) moveRight(4) A head and body Wings
moveUp(3) Repeat 2 times Scaly skin Six legs
moveRight(2) A hard outer skeleton A long neck
moveDown(1) moveUp(2)
moveLeft(1) moveLeft(1) Earwig: Insect
Ant: Insect
moveUp(3) Centipede: Neither! It is actually
moveLeft(2) an animal called a myriapod.
moveDown(2)

135

Did you Malware

know? Sometimes people write bad code to try
to steal information or stop your machine
There is so much more to from working. These programs are known
computer science than just as malware.
programming. Computer
science has a relatively Trojan horse This is a bad
short history but a lot has program disguised as a good one.
happened in that time! Once you install it, it can help
people steal your data.
Debugging
Virus A computer virus is a lot
In 1946, after noticing that like a human virus, copying itself
a program was producing and infecting other programs
bad results, the team working on the without permission.
ENIAC computer found a moth stuck inside
it. Admiral Grace Murray Hopper taped the Backdoor programs These
moth into her notebook, commenting that programs allow someone to
it was the first “actual case” of a bug being access your machine without
found in code. a password.

Vulnerability scanners Some
people are able to run scanners
on systems to find the insecure
places where they can get in.

Sniffers As your information
passes through the internet,
sniffers can inspect each item
looking for important data.

Worms A computer worm is a
small piece of destructive code
that can spread from computer
to computer.

Keylogging Criminals can install
keyloggers on other people’s
computers to record the keys
they press, in order to steal data.

Fun fact

One of the first computer viruses was written in 1982
as a joke by 15-year-old American Rich Skrenta. He made
a virus called Elk Cloner, which made a poem appear on
the screen of infected Apple II computers.

136

Early computers

1 2 3

Pascaline mechanical calculator Konrad Zuse’s Z3 Presented Manchester Baby Considered
Created by Frenchman Blaise in Germany in 1941, some think small for its day, this English
Pascal in 1642, this machine this is the first example of a machine was built in 1948 to test
could add and subtract. reprogrammable computer. random access memory (RAM).

4 5 6

Electronic Numerical Integrator IBM 360 First sold in 1965, this TRS-80 By 1977, the TRS-80
and Computer Finished in 1945, the series of machines could all run had become a popular personal
ENIAC performed complex calculations, the same software, so they could computer. It had a keyboard and
but it could take days to program. be easily upgraded. could run games.

What a difference! Binary 0 1

Colossal computer Almost all modern computers use
In the 1950s, IBM built the binary system to send and store
the SAGE system— data. Information is converted into
a series of connected 1s and 0s, which the computer can
computers each change into electronic signals.
weighing in at
250 tons Data measurements
(225 metric tons).
File sizes are usually 1 Bit = Single Binary Digit (1 or 0)
Miniature machine measured in terms of 1 Byte = 8 Bits
In 2018, IBM produced bytes. A byte is a unit 1 Kilobyte (KB) = 1,024 Bytes
a computer that is about the size of what 1 Megabyte (MB) = 1,024 KB
smaller than a grain of it takes to store a 1 Gigabyte (GB) = 1,024 MB
salt, but more powerful single letter, number, 1 Terabyte (TB) = 1,024 GB
than the desktop or symbol. Large 1 Petabyte (PB) = 1,024 TB
computers of the amounts of data have 1 Exabyte (EB) = 1,024 PB
1990s. Two are fitted their own names.
to the motherboard
shown here.

137

Glossary event Coded trigger
that causes other code
to start running

abstraction Making code Programmed computer science Study fiber-optic cable Cable
something more simple instructions that tell a of the use of computers for that sends data using light
by removing details computer what to do solving problems
forever loop Control block
algorithm List of steps coder Someone who condition Statement that in Scratch that repeats code
that tells you how to do writes code must be true in order for over and over until the
something something to happen program ends
coding Writing code
artificial intelligence (AI) conditional Code that function Named section
Ability of a computer to do collaboration Working checks whether something of code that can be reused
tasks that usually only a together is true or false before it
human can do, such as think proceeds games console Computer
or learn collision When two designed to run games,
objects touch played using controllers
block Puzzlelike piece of
code that can be dragged computational thinking creativity Ability to green flag Flag symbol
into a program Solving problems the way a produce different and above the Scratch stage
computer would solve them new ideas that is often used to start
block-based programming programs
Graphical computer computer Machine that data Pieces of information
language that lets users takes in information and hardware Any part of
connect blocks to build code processes it. It has an debugging Finding and a computer that you can
option to store this fixing bugs touch
bug Mistake in a program information or send
or algorithm something back out decomposition Taking hacker Person who writes
a problem and breaking it code designed to find safety
click Press of the mouse computer language down into pieces that are flaws in computers
button one time Special kind of language easier to understand
that a computer can hat block Any of the blocks
understand define (a function) Writing that you can use to start a
code that tells a computer new script in Scratch
what a function should do
if statement Set of code
download File copied to that only runs if a condition
your computer from the is true
internet
if/else statement Set of
double-click Clicking the code where one section
mouse button twice, quickly runs if a condition is true
and a second section runs
drag Holding the mouse if the condition is false
button down as you move
it across the screen input Information sent to
the computer or program,
drop Releasing the mouse such as mouse-clicks, key
button after dragging presses, or movements
something picked up by a camera

instruction Line of code program Complete section
or command of code that performs a task

internet Set of programmer Someone
interconnected computers who writes programs
that allow people to
communicate across programming Writing
the world programs

loop Code that repeats programming language value Number, word, or USB cable Wire that
over and over again Language that a programmer other piece of information, connects different pieces
uses to write code including answers given of hardware that have a
malware Code designed to in Scratch in response to USB (Universal Serial Bus)
steal information or damage remixing Creating a new “ask” blocks connector
a computer version of a project that
already exists variable Placeholder that x position Position of a
minicomputer Computer can be used to refer to sprite on a horizontal axis
that is tiny but has power repeat Do the same information whose value
similar to a full-size thing again isn’t known at the time of y position Position of
machine programming a sprite on a vertical axis
resilience Determination
online Using the internet to keep going even when website Page of
something is hard information that can be
output Information put out found online
by the computer or program, run Start a program
such as words, images, or Wi-Fi Way of sending
sounds robot Machine that information from one
independently takes actions place to another without
parameter Extra piece of based on information that wires
information that some it collects
functions need to work World Wide Web Network
script Name used for a set of computers that talk to
pattern Something that’s of code each other using an agreed-
shared between two or upon language
more things software Programs that
operate on a computer or
pattern matching machine
Recognizing and finding
patterns sprite Computer image
that can be controlled
PC Shortened name for a with code
personal computer
stage Part of the screen
persistence Determination where sprites appear in
to try something over and Scratch
over until you succeed
statement Complete
pixel Tiny single-colored piece of code that makes
square or dot that is part of a computer do something
a bigger image. The Scratch
stage is measured in pixels username Made-up name
that refers to a specific user

139

Index delete (blocks) 74
downloading 72, 73, 132
Aa Bb Cc drawing 20–21, 24–25,

abstraction 64–65, Babbage, Charles 14 C++ 85 28–29, 78, 92–93, 113,
122–123 backdrops 75, 79, 102 castle, decomposing 58–61 115
balloons 38–39 central processing unit drawings, debugging
Aldrin, Buzz 55 Berners-Lee, Tim 69 20–21
algorithms 10–13, 15, 18, Bill & Melinda Gates (CPU) 44, 45 drums 22–23, 94–95
Foundation 125 cheese biscuits 40–43
20, 80–83, 86, 116 binary 137 chess 37 Ee
Allen, Paul 124, 125 biscuits 40–43 clones 76, 106, 109, 133,
Altair 8800 124 bits 137 edit menu 74
Altair BASIC 124, 125 block types 76 134 Eich, Brendan 85
analytical engine 14–15 blocks 72, 74, 76, 77, 82, coders 5, 6, 7 ENIAC (Electronic Numerical
answers 135 coding programs 86–87
Apollo 11 mission 55 84, 86 collaboration 28–29, 94–95, Integrator and Computer)
arachnids 62 Blocks Palette 74, 75, 76, 136, 137
Arduino 131 126
Armstrong, Neil 55 118, 122, 132 collisions 46–47, 106–107 Enigma machine 36–37
artificial intelligence 37 Bombe 37 color change blocks 90, erase all block 92, 93, 96,
astronauts 54–55 breaking loops 91
augmented reality 26 bugs 20, 85, 88–89 91 97, 113, 115, 127, 129
bytes 137 comic strips 64 errors 7, 20–21, 88–89
computer science 36, 110, Event blocks 76, 77,

125, 136–137 102–103
computers 44–45 events 38–39, 46, 76, 80,
condition blocks 91, 98–99,
91, 102–103
100–101, 106, 107 extension blocks 74, 76,
conditionals 32–33, 34,
112, 132
98–99, 100-101
consoles 27, 110–111 Ff
Control blocks 76, 106
controllers 27, 132, 133 fiber-optic cables 69
coordinates 20–21, 77 file menu 73, 74
core routers 68 file size 137
costumes 74, 76, 79, flowcharts 80, 81, 82–83,

120-121, 128 86–87, 116, 117
creativity 24–25, 92–93 forever loops 90, 100, 129
creepy-crawlies 62–63 fortune-teller 50–53
cursor 46 fruit biscuits 40–43
full screen 75
Dd function blocks 112–113,

dancing 34–35, 100-101 120, 122, 126, 132
data measurements 137 function with parameter
debugging 20–21, 88–89,
blocks 114–115, 118,
96, 136 119, 121, 123, 126
decomposition 58–61,
functions 50–53, 56–57,
116–119 76, 112–113, 114–115,
define blocks 112, 114, 116–119, 120–121,
122–123, 126, 132
118, 121, 122, 123,
126, 132 Gg
degrees 50, 97, 113, 115
games 26–27, 110–111
Gates, Bill 124–125
Gates, Melinda 125
Glenn, John 54
go to blocks 77
graphics card 44

when clicked matching patterns 62–63,
120-121
say Ahoy! for 2 seconds
mathematics 14, 36, 54–55,
move 50 steps 125

say Let’s walk, matey. Matsumoto, Yukihiro 85
mazes 56–57
move 300 steps memory 14, 44–45, 84
messages, coded 36–37
Let’s walk, matey. micro:bit 130–131, 132–

Hh Jj loops 22–23, 49, 57, 76, 134
90–91 micro:bit Extension 132
hard drive 45 JavaScript 85, 130 micro:bit HEX 132
hardware 44–45 Johnson, Katherine 54–55 loops blocks 76, 90–91, 93, Microsoft 27, 124–125
Harvard University 125 96, 97, 100, 113, 115, minicomputers 6, 130–131,
“Hello, World!” 85 Kk 118, 119
hide blocks 88–89, 134 132–134
home router 69 key pressed? blocks 98, 99, Lovelace, Ada 14–15 mobile connection 68
Hopper, Admiral Grace 100 mobile gaming 27
Mm mobile towers 68
Murray 136 keyboards 6, 40, 44, 98, moon landings 55
human computers 54 104 mac OS 132 motherboard 44, 45, 137
humanoid robots 131 malware 136 Motion blocks 76, 77
keylogging 136 Manchester Baby 137 mouse 45
Ii Massachusetts Institute of mouse down? condition 98
Ll Technology (MIT) 84 music 22–23, 76, 94–95
IBM 137 Music Extension 76
IBM 360 137 laptops 68, 69 My Blocks 76, 112, 114,
if then 98–99, 101 LED lights 130, 134
if/else blocks 100–101 Looks blocks 76 118, 121, 122, 126
if/else statements 34–35
ingredients 40–41 Nn
input 40–43, 44, 45,
name blocks 112
104–105 NASA 54–55
insects 63 Nintendo 27, 110–111
instruments, musical 22–23, Nintendo DS 110, 111

26–27, 94–95
interactive programs

104–105, 126–129
internet 6, 26–27, 68–69,

131, 136
ISP (Internet Service

Provider) 68, 69
“Iwata Asks” 111
Iwata, Satoru 110–111

141

Oo pen tools 76, 92–93, remixing 66–67, 126–129 Ss
112–113, 114–115, repeat loops 90, 91, 118
Obama, Barack 125 126–129 repeat until loops 91, 98, safety 4, 73
online gaming 26–27 SAGE system 137
online safety 73 Pen Extension 76 99, 101 saving work 72, 73, 74
operating systems (OS) permissions 104, 127 reset function 121 say blocks 84
persistence 7, 30–31, rhymes, remixing 66–67 scavenger hunt program
73, 124, 125, 132 rhythm 94–95
Operator blocks 76 96–97 robots 130, 131 18–19
order, algorithms 77, 81 pixels 16–17, 77 routers 68–69 scores 108–109, 132–134
origami 10–13 Playstation 27 Ruby 85 Scratch 72–83, 86–109,
output 40–43, 44, 45, poems 66, 67
pointing, persistence 112–123, 126–129, 130,
104–105 132–134
30–31 Scratch library 78
Pp Pokémon GO 111 Scratch Link 132
Presidential Medal of Scratch map 75
Paint tool 78 Scratch website 72, 73
paper chains 48–49 Freedom 125 screen layout 74–75
paper pixels 16–17 problem-solving 6, 24, 36, screens 16, 44, 45
parameter path 56–57 scripts 77
parameters 56–57, 114– 58, 62 Scripts Area 74, 75
program writing 18–19, Sensing blocks 76, 119
115, 117, 118, 121, 122, sequence 80–81
123, 126 86–87 sheet music 10
Pascal, Blaise 137 programming languages show blocks 88–89, 134
Pascaline mechanical smartphones 27, 44, 68
calculator 137 84–85, 124, 130 sniffers 136
pattern matching 62–63, punched cards 15
120–121 Python 84, 85, 130
patterns 96–97, 113, 115,
126–129 Rr
PCs 44, 73, 124
RAM (random access
memory) 44–45, 137

Raspberry Pi 130, 131
recipes 10, 40–43

142

songs 66, 67 TRS-80 137 Ww Yy
Sound blocks 76 true or false 32–35, 98–99,
sounds 74 wait blocks 88, 90, 123 yes-or-no questions 32–33,
spacecraft 54–55 100–101 webcams 76, 104–105, 52
speakers 45, 104, 130 Turing, Alan 15, 36–37
speech bubbles 76, 83 Turing machines 36 126–129 Zz
Sprite List 75, 78, 107 Turing test 37 web pages 85
sprites 75, 78–79 turn blocks 76 Wi-Fi 69, 131 Z3 137
stage 75, 79 Turochamp 37 Wii 27, 110 zoom 75
Stage List 75, 79 tutorials 74 Windows 124, 125, 132 Zuse, Konrad 137
stamp blocks 96–97, 128 wires 69
statements 32–35, 98 Uu World War II 36, 37
stories 29, 64–65, 66, 67 World Wide Web 69
Stroustrup, Bjarne 85 underwater cables 68 worms 136
symbols 18–19, 137 Uno 131
USB cables/ports 131, Xx
Tt
132 x and y locations 77
teamwork 28–29, 94–95 Xbox 27
telephone exchange 68, 69 Vv
templates 24–25
text-based languages 84, value, variables 48–49,
108–109
85
touching color? blocks 98 van Rossum, Guido 84
touching conditions 98, 99, variables 48–49, 108–109,

100, 104–105, 106–107 114–115, 117–119,
Trojan horse 136 132–134
Variable blocks 76
video games 26–27,
110–111
video sensing 104, 127
Video Sensing Extension
76
virtual reality 26
viruses 136
visual programming
languages 84
vulnerability scanners 136

143

Acknowledgments

DK would like to thank the following: Caroline Hunt for proofreading; Helen Peters for the
index; Ruth Jenkinson for photography; Elisabeth Smith for the Models; the models; Anne Damerell
for legal assistance.

The publisher would like to thank the Photo: CSueb. 75 NASA: JPL-Caltech / Space Library: IBM RESEARCH (bl). 140 Alamy Stock
Science Institute (c, cb). 84 Dorling Kindersley: Photo: INTERFOTO (bl). 142-143 Rex by
following for their kind permission to Mark Ruffle (tc, tr). 84-85 Dorling Kindersley: Shutterstock: James Gourley (bc)
Mark Ruffle (bc). 85 Dorling Kindersley: Mark
reproduce their photographs: Ruffle (tc, tr, crb). 94 Dorling Kindersley: Cover images: Back: 123RF.com: Volodymyr
National Music Museum (cl). 110-111 Krasyuk br; Spine: 123RF.com: Chirawan
(Key: a-above; b-below/bottom; c-center; f-far; Dreamstime.com: Wachiwit (bc). 110 Dorling Somsanuk t
l-left; r-right; t-top) Kindersley: Mark Ruffle (tr). Getty Images:
Noah Berger / Bloomberg (bl); SSPL (cl). 111 All other images © Dorling Kindersley
1 Dorling Kindersley: Mark Ruffle (c). 6 Alamy Stock Photo: ATStockFoto (crb). Dorling For further information see:
Dorling Kindersley: Ruth Jenkinson (br). Kindersley: Mark Ruffle (tr). 124-125 Alamy www.dkimages.com
Dreamstime.com: Geopappas (cra); Robyn Stock Photo: INTERFOTO (c). 124 Dorling
Mackenzie (ca); Valleysnow (tc). 8-9 123RF.com: Kindersley: Mark Ruffle (tr, clb). Getty Images:
Alessandro Storniolo. 14-15 Getty Images: Mark Madeo / Future Publishing (br). 125 123RF.
Science & Society Picture Library (c). 14 Alamy com: Roland Magnusson (cb). Alamy Stock
Stock Photo: IanDagnall Computing (bl). Dorling Photo: dpa picture alliance (br); Jannis Werner /
Kindersley: Mark Ruffle (tr). 15 Alamy Stock Stockimo (cra). 130 Robotical Ltd.: (cr). 131
Photo: Walter Oleksy (br). Dorling Kindersley: Alamy Stock Photo: Dino Fracchia (b). 136
Mark Ruffle (tr, cb). 26-27 Alamy Stock Photo: Alamy Stock Photo: Science History Image (bl).
Chuck Franklin (ca). Dreamstime.com: Jenyaolya 137 Alamy Stock Photo: Zoonar GmbH (ca);
Pavlovski (bc). 26 Alamy Stock Photo: Jochen Mark Waugh (tr); Pictorial Press Ltd (cla); Science
Tack (bl). 27 Alamy Stock Photo: Andriy Popov History Images (tl); INTERFOTO (tc, cra). Getty
(crb); True Images (cra). 28 Dreamstime.com: Images: Andreas Feininger (cb). Science Photo
Piotr Marcinski / B-d-s (bc, tc); Nataliia Prokofyeva /
Valiza14 (tr). 29 Dreamstime.com: Nataliia
Prokofyeva / Valiza14 (br). 36 Alamy Stock
Photo: INTERFOTO (br); Kumar Sriskandan (clb).
Dorling Kindersley: Mark Ruffle (tr). 37 Alamy
Stock Photo: Bletchley Park - Andrew Nicholson
(cl). Dorling Kindersley: Mark Ruffle (tr). Rex
by Shutterstock: James Gourley (bc). 44
Dreamstime.com: Panyawuth Chankrachang
(bc); Kenishirotie (cra); Leung Cho Pan /
Leungchopan (bl). 44-45 123RF.com: Volodymyr
Krasyuk (bc). Dreamstime.com: Gawriloff (tc).
45 123RF.com: Vitaliy Kytayko / kitaec (br).
Dreamstime.com: Kenishirotie (ca); Milotus (c);
Wellphotos (bc). 54-55 NASA: (c). 54 Dorling
Kindersley: Mark Ruffle (clb, tr). 55 Dorling
Kindersley: Mark Ruffle (cr, br). NASA: (tr). 63
Dorling Kindersley: Forrest L. Mitchell / James
Laswel (tl). 64 Dorling Kindersley: Mark Ruffle
(bc, r, tl). Dreamstime.com: Sataporn Jiwjalaen /
Onairjiw (tr). 65 Dreamstime.com: Sataporn
Jiwjalaen / Onairjiw (br). 66-67 Dreamstime.
com: Juan Carlos Tinjaca (bc). 69 Alamy Stock
Photo: Justin Leighton (br). 70-71 Alamy Stock

144


Click to View FlipBook Version