Puzzles For Computational Thinking
Puzzles For Computational Thinking
1
E S
ZZL s
PU zz
le
Pu
k ing
Thin
al
2
1
io n
t at 6
m pu 3
4
5
Co
10
9
8
7 A
22 11 11 24 11 8 14
B
C
12 10 14 7 19 8 18 5 16 8 8 7 22
12
D 11
4 14 8 16 15 10 2 E
9 6 F
1001 0110 11 19 10 3 14 20 6 11 13 11 19 24 8
G
3 H
1 2
1 11 10 18 9 18 25 8 17
0011 I
0001 0010 J
24 11 18 15 8 3 9 16 22 19 22 18
A R L
K
18 3 8 20 3 19 11
L Card A
12
8 4
E
1100 21 8 25 22 22 11 19 16 18 11 19 8 M
N
1000 0100 14 11 19 10 18
O
12 11 1 22 15 10 10 12 18 10 3 8 P
Q
25 11 22 8 23 14 14
R
22 19 11 22 24 22 10 20 21 23 7 10
S
T
24 19 8 11 3 10 11 U
V
26 10 15 8 3 11 3 11 26 7 8 19 22
W
7 9 7 14 17 10 8 X
Y
Z
T T H H
0 1 2 3 4
1
Computational thinking puzzles Word search
Words can appear in the grid horizontally, vertically or diagonally, running backwards or forwards. Different
Computational thinking is a core set of skills that computer scientists develop as names can cross and overlap.
they learn to program. It isn’t something you can only learn through programming
Find the following famous computer scientists’ names in the word search grid. Their first and second names
though. Puzzles can be a great and fun way to develop the skills. This puzzle book may be in different places. Spaces, accents and hyphens are not included.
involves a wide range of puzzles that involve aspects of computational thinking.
ADA LOVELACE, ANITA BORG, BARBARA LISKOV, DANA ULERY, DOROTHY DENNING, FRAN ALLEN,
Some are algorithmic puzzles where the aim is to come up with an algorithm that GRACE HOPPER, JEANNETTE WING, KAREN SPARCK-JONES, MARISSA MAYER, MUFFY CALDER,
solves the puzzle. Many like Kakuro and Cut Block puzzles are logic puzzles, that URSULA MARTIN, WENDY HALL
are all about logical thinking. To be good at them, though, involves inventing your ALAN TURING, CHRIS STRACHEY, EDGAR CODD, EDSGER DIJKSTRA, JOHN VON NEUMANN,
own rules and algorithms for solving them. Yet others, like code cracking grids MAURICE WILKES, MUHAMMAD AL-KHWARIZMI, NIKLAUS WIRTH, PHILIP EMEAGWALI, SERGEY BRIN,
involve computing concepts and algorithms in puzzle form. TIM BERNERS-LEE, TONY HOARE, VINT CERF
Which extra name appears in the grid: a forgotten genius of Bletchley Park?
If you enjoy these puzzles more can be found at www.cs4fn.org/puzzles/
Puzzles are most of all for fun, but it’s always good to be learning useful skills too. N K R E C S N I R U T J E A L U S R U
A A E F R E C A C N I U E W V N H O J
M R O M A K B R I T M O R N H F B Y V
H E A D A L O V E L A C E I M R R S P
C N N I W I R T H O O O P K R A I E H
L S I J P W E N D Y H A L L E N N R I
E P T K K K N V O K S I L A Y I F G L
W A A S C H M A U R I S E U A V Z E I
N R G T A W E E L T R U M S M R S Y P
O C G R O B G E F A J E A N N E T T E
D K Y A A N W X G A R D R L A D I M M
R J H G I C O D D A Z S T O S L M U E
O O T W O O E S O H J G I O S A Z H A
G N O N T P I H E D S E N P I C I A G
R E R E H R Y E O B A R B A R A R M W
A S O U H N C I J P D C G K A L A M A
C B D C O I U H E L P M N Y M M W A L
E O S T R A C H E Y D E I C R N H D I
L R P U D E N N I N G E R O O E K B P
E N A W S R E N R E B M U F F Y L R Q
E M V O N N E U M A N N T D A N A U A
24 11 18 15 8 3 9 16 22 19 22 18
I
J
4 3
A R L
18 3 8 20 3 19 11
K
L
21 8 25 22 22 11 19 16 18 11 19 8 M
14 11 19 10 18
N 2 5
O
12 11 1 22 15 10 10 12 18 10 3 8 P
Q
25 11 22 8 23 14 14
R
22 19 11 22 24 22 10 20 21 23 7 10
S
T
24 19 8 11 3 10 11 U 1 4
V
3
26 10 15 8 3 11 3 11 26 7 8 19 22
W
7 9 7 14 17 10 8 X
Y
Z 6
14 7 22 12 11 20 8 7 10 10 7 8
2 3 5 4
20 11 7 24 8 11 18 25 10 16
22 20 18 8 11 3
ii)
No robots are evil. 6
All mobile phones are robots.
Therefore we can conclude:
a. All mobile phones are evil. Bit ladder 0 0 0
b. All robots are mobile phones. Convert the binary word 000 into the binary
c. Some mobile phones are evil. word 100 in 7 steps or less. You must only - - -
d. None of the above. change one bit of the word on each step.
You may only use 1s and 0s. - - -
iii)
All bugs are poor computer software.
- - -
Some rounding errors are bugs.
Therefore we can conclude:
a. All rounding errors are poor computer software. - - - Funny bit
b. Some rounding errors are poor computer software. There are 10 types of people:
c. Some rounding errors are false. - - - those who understand binary,
d. None of the above. and those who don’t.
- - -
iv)
All educational things are useful. 1 0 0
Some websites are not useful.
Therefore we can conclude:
a. Some websites are not educational.
b. All websites are educational.
c. All educational things are not websites.
d. None of the above.
The following version has three mistakes. Can you spot the differences?
6 10
# This program adds two numbers provided by the user 5
# Store input numbers 7 5
num1 = input(‘Enter first number: ‘) 3 6 19 4
num2 = input(‘Enter second number: ‘) 10 10
7
# Add two numbers
8 10 3
sum = float(num) + float(num2)
6
# Display the sum 6
print(‘The sum of {0} and {1} is {2}.format(num1, num2, sum) 17 16 14 7 6
16 21
16
30 3
16 5
Funny bit
Two bits walked into an
expensive bar, but were
thrown out because they
didn’t have enough
for a byte.
11
Extreme logical thinking: a trip to market
5 15
0101 1111
A farmer is on her way to the local village with her sheepdog, Mist, who goes with her everywhere. To get to
3 the village she has to cross a fast flowing river. An inventor living on the village side of the river has created a
0011 contraption to make it easier to get across. It consists of a rope and pulleys, with a seat hanging from the rope
11 13
1011 1101 just big enough for one person. The locals have agreed to always leave the seat at the village side where the
15 inventor lives so that it is easy for her to pack it away each evening: after all she is not charging anyone to use
1111 it. When she gets to the river the farmer pulls the seat across from the far side using the rope. She gets in,
15
1111 hugging Mist, then pulls herself across and continues into the village.
5 12
0101 1100 On one particular day she buys a new hen and a sack of corn. Returning home later in the day she arrives
back at the ravine, and quickly realises she has a problem. She can only carry one thing across with her as she
9 9 crosses using the seat. She will have to make several trips. The trouble is, if she leaves the hen and the corn
1001 1001 alone on either side, the hen will eat the corn. Similarly if she leaves Mist and the hen together on one side the
9
1001
dog will worry the hen and may mean it stops laying eggs. Mist doesn’t eat corn so it will come to no harm if left
3 with him.
0011
Write down the series of steps (the algorithm in computer science jargon) that she must take to get everything
12
across so she can continue on her way.
1100
2 1 1 2 2 1 2
1 2 2 2 3 1 1 1 1 2 1
4 2 1 1 2 2 2 2 1 2 2 1 Science Museum
Hotel
1 1 1 1 2 2 1 2 1 1 1 1 1 1
1 1 2 3 12 10 1 2 2 1 2 3 2 1 15
2 2 1 3 3
2 1 2 3 2 Cathedral Castle
1 2 2 2 1
1 3 4 3
Zoo Toy Shop
2 1 2 1
Aquarium War Ship
7 2 1 1
2 2 3
5 2 1
2 4 1 1 2
Art Gallery Wax works
2 1
2 1 1 1 1
1 3 1 1
4 2 3 1
15
7 8 9 10 T H
0 1 2
11 12
17 T T H H
T T T H H H
0 1 2 3 4 5 6
North Bank
West Island
East
Island
South Bank
E B R N N E D W A N O O U C O - - - - -
X I A U N S P O S T F H P U C - - - - -
- - - - -
T C S B S E S R C O T S M R I
- - - - -
O O P E R N R K R C W P O I A
- - - - -
H S U T A T S I I I A A C T L
- - - - -
S P Y W A R E N P A R N R Y R - - - - -
N S H E L L R G T Y E S E N E G E N E S
E C H L L A V R E S U C P S M
E O E O E S E K S H E R U T M
R R R S H A R E W A R E S O A
21
C C W S P R E A D S H E E T P
S T O R A G E S N A C N A C S Lovelace’s life ladder
Ada Lovelace is famous as the ‘first programmer’ and also predicted computers would one day compose music.
Born on the 10th December 1815, she died at the age of 36. Use the clues to fill in the missing numbers that
completes the move from life to death, changing only one digit at a time?
Date Clue
Napier’s life ladder (from birth to bones) Thursday BFF: ______________ Texts from them on Thursday: ______________
John Napier was a Scottish mathematician, famous for discovering logarithms. He also devised a calculator
for doing multiplication and division using wooden rods (or bones). Number patterns written on the bones Friday BFF: ______________ Texts from them on Friday: ______________
combined in various ways to let you read off the correct answer to your calculations. Calculate the missing
numbers below to get from Napier’s year of birth to his death changing only one digit at a time. Write the number you would tweet down here (adding the 5 numbers above): ______________
Date Clue Remember you chose the five BFF at random, you might even have changed your mind, so how can it be I
know you would tweet fifty eight? Can you puzzle out how the trick works?
1 5 5 0 John Napier was born
_ _ _ _ 11001110010 in decimal
A bit of computational thinking wisdom
_ _ _ _ The logarithm to base 10 of this number is 3.21932250842 Once they’ve solved a problem and invented an algorithm to do it, computational thinkers generalise it
so they can use the solution in different ways. Find out how you could base your own tricks on the secret
1 6 1 7 John Napier died
algorithm by going to www.cs4fn.org/puzzles/
6 25 24 20 8 9 5 21 7 2 7 2 23 24 7 3 6
Card A Card B Card C Card D
E G 2 3
8 19 10 24 12 5 21 7 10 16 24 6 8 19 16 20
7 5 2 7 22 22 23 8 7 17 25 24 2 6 25 24
22 23 8 10 16 24 3 8 19 25 24 23 24 7 23 6 25
b) On another day, you are shown a different set of four cards as below. This time each card has the details of
10 8 9 5 2 13 6 7 6 24 18 12 6 25
a person in a shop on it. On one side is their age and on the other is what they are buying. If a person is buying
fireworks then they must be over 18. Which cards should you turn over to check everyone is shopping legally.
6 20 22 12 17 7 16 21 9 13 6 8 7 5 2 7
Buying Buying
Age 25 Age 16
Key Rockets Milk
1 2 3 4 5 6 7 8 9 10 11 12 13
14 15 16 17 18 19 20 21 22 23 24 25 26
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
27
$ [ % @ &
__ / 5 __ / 6
__ / 2
INLET OUTLET
# % ; > } $
__/19
__ / 7 __ / 5
& $ % @ [
__ / 3 __ / 8
__ / 4
& > %
# } [ % ; >
__ / 3
__ / 3 __ / 1 __ / 7 > ; [ } $
__ / 2
INLET
__ / 5
__ / 5 __ / 5 OUTLET ; } > % $ & # @
__/14
__ /6
__ / 8
__ / 5
__ / 1
__ / 2
NEXT J i = i - 1;
X=J*X+2 if( i == 6 ) Number search grid
Print X break;
END }
1 3 4 5 6 1 9 8 1 2
9 1 7 1 0 2 4 9 5 2
7 1 8 0 3 1 8 6 9 1
2 3 2 2 2 2 7 1 3 9
1 3 8 6 3 4 8 3 5 5
Funny bit 1 1 3 2 7 6 1 2 8 4
There are 10 types of people: those
who understand binary, those who
5 9 1 2 0 2 9 4 7 3
don’t and those who didn’t expect 1 3 1 7 7 6 3 9 9 8
this joke to be in ternary.
1 8 1 5 9 5 3 0 0 1
0 1 8 5 2 1 2 6 5 2
E
9
B
1001
H F
C M
I
D
A bit of computational thinking wisdom L N
Binary numbers are based on powers of 2. You may have noticed that, because of this, all the binary
versions of the numbers you are writing in the grid have only a single 1 in them. The position of the 1s in
A K
the numbers being added correspond to the number in the clue they add to. So, for example, to make 13
(1101) you need to use the numbers 8 (1000) + 4 (0100) + 1 (0001). The binary tells you which numbers
you need to use! J G
Codebook
0 [little ]
1 [code]
2 [in the ]
3 [ninety-nine ]
4 [one ] Funny bit
5 [compile ] def thanoi (pieces, movefrom, moveto, other):
[“hip”,”hip”]
6 [bug] if pieces == 1:
- hip hip array!
7 [and ] print (“move ring from”, movefrom, “-”, moveto)
8 [s hiding ] else:
9 [06821] thanoi (pieces-1, movefrom, other, moveto)
A [ is fixed ... ] thanoi (1, movefrom, moveto, other)
B [we ]
thanoi (pieces-1, other, moveto, movefrom)
C [39,]
D [it all ]
E [ hundred ] We have hidden the program in the following word search grid vertically and horizontally. Punctuation is included
F [again,] at the start or end of words. Spaces separate words. Repeated words appear multiple times. Can you find the
G [there are] whole program.
H [ a]
I [ fixed ] i f o t h e r ( : 1 = = ) v e f m
p r = t n i r p i n = : o ) h r o
34 i
e
o
n
t
h
h
a
a
(
n
p
o
i
i
e
“
c
-
e
“
s
,
,
t
e
m
o
a
n
o
-
v
e
c “ a n ( “ o c r i n ) v r , 1 t
e , n o m o t e l s e : o f m m o
Troubling Communication s v o i m d m s g n i r m e o o )
You are a Doctor in a hospital, where a new patient needs help. They have had a stroke that has left them with ( p i e c e s - 1 , o v o v r v o
‘Locked-in syndrome’. This means they are almost totally paralysed, unable to move, or even speak, though d e m t h f p 1 , “ t p v o f e :
they are fully conscious and still intelligent. They can see and hear everything around them, but just can’t
e v o m “ ( 1 , d t h a e m e f )
communicate back. The one movement that they have is that they can blink one eyelid, though that is quite
an effort to do. You cannot cure them, but perhaps you can help them to communicate.
m o v e f r o m , f e f t s v r r
, r e h t o o t h e r ) o = o o e
a) Devise a way, that you can explain to them, that will allow them to talk to you. As all they can do is blink, they m o t h a n o i r i , t , = m m h
will need to use blinking to communicate letters, and so words, to you. What do you need to do, and what do o m o v e f r o m , f r o m “ , t
they need to do to make it work? m r , m o v e t o , t h a n o n o
b) How might you adapt the method you have suggested if blinking is easier for them to make it quicker for
them to communicate.
L A M P
Puzzle 3: the simple cut block puzzles L A M A
L A V A
J A V A
1 3 2 1 4 2
4 5 1 2 3 1
Puzzle 6: bit ladder
1 3 2 1 4 2 Here is one solution: 0 0 0
2 4 1 3 5 1 0 0 1
0 1 1
0 1 0
1 0 0
Ready, aim, aim, aim, aim ... (the slow approach to software development).
1812
1852