UCC Science, Engineering & Food Science Public Lecture - Professor Barry O'Sullivan
Computers are extremely important in modern life. Understanding how they work, how they reason, how they "think", what are their limitations, is a fascinating subject called computer science.This lecture is focused on making the fundamental ideas of computer science accessible to children from the ages of 7-12 and their families. We present a set of learning activities that teach computer science through engaging games and puzzles that use cards, string, crayons and lots of running around. This lecture presents a subset of activities that form part of a Public Engagement Programme for Dublin City of Science 2012.
Professor Barry O'Sullivan is Head of Department for Computer Science at University College Cork, Ireland. He is also Director of the Cork Constraint Computation Centre in the Computer Science Department at UCC, SFI Principal Investigator, Past President of the Association for Constraint Programming, Chairman of the Artificial Intelligence Association of Ireland, Coordinator of the EuropeanResearch Consortium for Informatics and Mathematics Working Group on Constraints, and Executive Council member of the Analytics Society of Ireland.
5. Computer science is about how we can solve problems with computers
Multi-disciplinary, rich, deep, and rewarding area of study
6. What will we be talking about tonight?
• Computer science is important - economically and intellectually
• From Binary Numbers to Images and Codes
• What’s wrong with my brain? (Human Computer Interaction, Stroop Effect)
• Running Together (Sorting, Data Structures, and Parallel Computing)
• Coloring In (Graph Coloring, Combinatorics and Complexity Theory)
• Card Trick (Error Detection and Correction)
• Scratch (Computer Programming for Children)
9. Best Jobs in the World, 2011
http://www.careercast.com
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26. Skills Required by New IDA Investments in 2011
ICT Business Manuf. Sales Other
Other
8%
Sales
12%
ICT
Manuf. 47%
14%
Business
19%
13,000 jobs in 2011
148 investments No recession in software!
28. Make sure the cards are placed in exactly the same order.
Now flip the cards so exactly 5 dots show—keep your cards in the same order!
Find out how to get 3, 12, 19. Is there more than one way to get any number?
What is the biggest number you can make? What is the smallest? Is there any
number you can’t make between the smallest and biggest numbers?
Extra for Experts: Try making the numbers 1, 2, 3, 4 in order. Can you work out a
logical and reliable method of flipping the cards to increase any number by one?
Representing Data
Binary Numbers
29. Binary Numbers - What’s this about?
• Computers use the binary system to represent numbers.
• What is binary? A two-valued number system - only numbers being 0 and 1
• In school you might have known it as ‘base 2’. We use ‘base 10’ everyday.
• Each 0 or 1 is a bit, and computers use transistors to represent them.
• How do we get large numbers? Using many bits.
• Eight bits is a byte.
30. Introduction
Before giving out the worksheet on page 5, it can be helpful to de
Understanding Binary
to the whole group.
For this activity, you will need a set of five cards, as shown below
and nothing on the other. Choose five children to hold the demons
front of the class. The cards should be in the following order:
Discussion
What do you notice about the number of dots on the cards? (Each
as the card to its right.)
How many dots would the next card have if we carried on to the l
31. (8-, 4-, 2- and 1-dot cards), then 21 (16, 4 and 1)…
Now try counting from zero onwards.
Numbersrest of the class needs to look closely at how the cards change to see if the
The in Binary
pattern in how the cards flip (each card flips half as often as the one to its righ
like to try this with more than one group.
When a binary number card is not showing, it is represented by a zero. When
showing, it is represented by a one. This is the binary number system.
Ask the children to make 01001. What number is this in decimal? (9) What w
in binary? (10001)
Try a few more until they understand the concept.
There are five optional follow-up extension activities, to be used for reinforce
32. Some Fun with
Binary
• How to we make:
•3
• 12
• 19
• What do these numbers mean?
• 10101
• 01010
34. simple binary code, which he knows the woman across the street is sure to
understand. Can you work it out?
6) 7) 8) 9) :) ;) <) =) >) 6?) 66) 67) 68)
5) @) +) 2) ') A) 3) &) ,) B) $) C) D)
69) 6:) 6;) 6<) 6=) 6>) 7?) 76) 77) 78) 79) 7:) 7;)
1) ") E) F) #) %) () G) -) H) I) .) J)
Kate will help us decode a message encoded in binary
8 Photocopiable for classroom use only.
35. Binary enables communications
!"#$%&''()*+(,-,(./)0123,4)356)7"6'2%)
Computers connected to the internet through a modem also use the binary
system to send messages. The only difference is that they use beeps. A high-
pitched beep is used for a one and a low-pitched beep is used for a zero. These
tones go very fast—so fast, in fact, that all we can hear is a horrible continuous
screeching sound. If you have never heard it, listen to a modem connecting to
the Internet, or try calling a fax machine—fax machines also use modems to
send information.
Using the same code that Tom used in the department store, try sending an e-
mail message to your friend. Make it easy for yourself and your friend though—
you don’t have to be as fast as a real modem!
36. using OHP transparency
are divided up into a grid of small dots called pixels (
ite picture, each pixel is either black or white.
Representing Images on a Computer
Data Compression - Run-Length Encoding
37. How are images represented?
• Each computer screen is a grid of dots, called pixels
• The simplest screens have only black and white pixels
• By turning on/off the dots we can make pictures, text, etc.
• Grayscale screens have pixels that have a shade between black and white
• Color screens have pixels that have millions of different colors
• Images can be represented as numbers, and there are lots of different ways
of doing that
38. In a black and white picture, each pixel is either black or white.
The letter “a”image of the letter ‘a’ to show the pixels. When a comp
A simple has been magnified above
picture, all that it needs to store is which dots are black and which are wh
!"#$"#!#
%"#!#
!"#%#
&"#!"#$"#!#
&"#!"#$"#!#
!"#%#
The picture above shows us how a picture can be represented by numbers
39. Computer screens are divided up into a grid of small dots called pixels (picture eleme
In a black and white picture, each pixel is either black or white.
A simple image of the letter ‘a’
The letter “a” has been magnified above to show the pixels. When a computer stores a
picture, all that it needs to store is which dots are black and which are white.
!"#$"#!#
%"#!#
!"#%#
&"#!"#$"#!#
&"#!"#$"#!#
!"#%#
The picture above shows us how a picture can be represented by numbers. The first li
This is a data compression technique called Run-Length Encoding!
consists of one white pixel, then three black, then one white. Thus the first line is
40. a rubber handy!
!"#$$#
!"#%"#&"#$#
!"#%"#&"#$#
!"#$$#
!"#%#
!"#%#
'"#(#
)"#$(#
$"#$'#
*"#'"#&"#+#
!"#&"#'"#&"#+"#$#
+"#$"#%"#$"#&"#$#
+"#$"#%"#$"#$"#$#
&"#$"#$$"#$#
&"#$"#$)"#&#
&"#$"#%"#$"#$"#$#
&"#$"#,"#$"#&"#$#
Kate will help us with some images.... &"#$"#("#$"#+"#$#
$"#$"#$"#$"#!"#&"#+"#$#
)"#$"#&"#$"#&"#&"#'"#$#
42. What’s wrong with my brain?
Human-Computer Interaction and the Stroop Test
43. Shout out the name of the color from top to bottom, left to right
44. Shout out the words from left to right, top to bottom.
45. Shout out the color of the words from left to right, top to bottom.
46. Why does this matter?
• To build good user interfaces we need to understand how we process
information in our brain.
• The test you have just done is the Stroop Test - many find it very difficult.
• Artificial Intelligence
• Cognitive Science
• Psychology
• Many disciplines can come together
48. What’s this all about?
• Sorting numbers (or any data) is a really important problem in computers.
• How do computers do things faster?
• We could figure out a better way of doing the calculation (algorithm)
• We could figure out how to represent the task a little better so we an then
figure out a different method (data structure)
• We could do things at the same time (parallel computing)
• We’ll look at a games which we can play in the school year
49. A Sorting Network
Sorting Networks
Prior to the activity use chalk to mark out this network on a court.
!"#$%&'$()"#*+)%*,-(./%0"!
This activity will show you how computers sort random numbers into order using
a thingcompare numbers at the circles, smaller go one way, larger in the other
We called a sorting network.
50. orting Networks
How does it work?
to the activity use chalk to mark out this network on a court.
$%&'$()"#*+)%*,-(./%0"!
activity will show you how computers sort random numbers into order using
ng called a sorting network.
nise yourselves into groups of six.Kate will demonstrate networkme...
Only one team uses the it with at a
52. What’s it about?
• A travel game for children: print
out lots of maps (like the one
on the right) and give your child
four different crayons - and no
more.
• For every map you give them,
they should be able to color it
so that no two countries that
have a common border have
the same color.
• Simple, but a very deep
problem, which we’ll discuss a
little shortly. But first...
54. Instructions: Color in the countries on this map with as few colors as
Kate - can you color this map with two colors? It might be difficult.
possible, but make sure that no two bordering countries are the same
color.
From “Computer Science Unplugged” Page 138
c Bell, Witten, and Fellows, 1998
55. These maps can be coloured with three colors only.
Instructions: Color in the countries on these maps with as few colors
as possible, but make sure that no two bordering countries are the same
56. Why is this deep?
• What if two children colored a
map together - one tried to use
very few colors, and other
didn’t care, how many crayons
do we need?
• We know 33 is enough, but it is
believed at most 10 are
needed. Nobody has proved it!
• Empires - two maps, a country
of each is paired with a country
from the other. Nobody knows
how many colors we need!
57. Why is this deep?
• Four colors are always enough:
conjecture in 1852, proved in
1976!
• Number of choices grows
quickly as the number of
countries increases, e.g. 50
countries in 1 hour; then 1 more
country would take 4 hours; 10
more countries requires one
year!
• The fundamental open question
in computer science is: “Does
P=NP?” We don’t know!
59. The Secret
• Kate put down 5x5 cards.
• My additional cards were
placed to ensure that the
number of pink cards in each
row and column were even.
• When Kate changed
something, my cards told me
exactly what she did.
• Automatic error-checking and
correcting key in finance,
communications & security.
60. What about actually using a computer, like?
Programming stories, games, music and art for children
63. Computer Science Unplugged is licensed under a Creative Commons
Attribution-Noncommercial-No Derivative Works 3.0 License.
csunplugged.org
orangestudio.co.nz
This book designed by
Credits
64. ‘Twas ten to midnight on December 24th
and all was not well in the far, far North.
IV
65. Some little elves were wrapping a thousand and twenty four toys,
roller skates for a thousand and twenty four good girls and boys.
V
66. At ten to midnight the elves called Saint Nick,
tonight, all the boxes had been filled extra quick.
Saint Nick was thrilled, “right then, fill up thesleigh,
a thousand and twenty four boxes and weʼre on our way.”
VII
67. Then Mrs. Christmas burst in through the doors
“Where are your dirty socks, Santa Claus?”
VIII
68. A young elf cried, “Santa, I dropped your dirty sockses
in one of the thousand and twenty four boxes!”
IX
69. “Quick, unwrap every single box!
Iʼm not leaving ʻtil you find those socks!”
“Sorry, Santa,” said the supervisor elve,
“us workers are all union, and we finish at twelve.”
XI
70. Said Santa, “No need to be unpleasant,
Iʼve got a big pair of scales, just weigh each present.
Theyʼll all weigh the same when you put them in each bucket,
except for one, and that oneʼs the culprit!”
XIII
71. “With all due respect,” replied the supervisor elf,
“Itʼll take a jolly long time, and you can do it yourself.
If we could make one comparison every second,
weʼd be here ʻtil twelve-oh-seven!”
XV
72. A little elf piped up: “I’ve got an idea!
We just need to use divide and conquer here.
XVI
73. Put half the boxes on that scale, and half the boxes on this,
whichever side goes up, that pile we dismiss!”
XVII
74. The supervisor elf, with an unimpressed gaze,
pointed out, “weʼll still be here for days.
Youʼve narrowed it down to five hundred twelve,
Hardly any help from this little elve.”
XIX
75. “Wait,” said the elf, only beginning his campaign,
“watch what happens when we halve it again.”
So they halved it again, and now their fix
was narrowed to two hundred and fifty six.
XXI
76. Then, after their third comparison of weight,
their problem was reduced to a hundred twenty eight.
XXII
83. ...itʼs true!
On the tenth comparison, with much joy,
this elf had found the erroneous toy.
A job that couldʼve gone well beyond the time limits
took just a matter of minutes.
XXXV
84. So the gift was replaced, the elves went home,
and Santa was set for his world-wide roam.
No poor child, far or near,
will have to smell Santaʼs dirty underwear!
XXXVII
85. But first the little elf was approached by Saint Nick,
“Where did you learn your clever trick?”
The little elf replied “On magic I make no reliance,
all I need to use is a little computer science.”
XXXIX