33
Paul Curzon Queen Mary University of London The Magic of Computer Science (Part I) teachinglondoncomputing.org/magicofcs/ Please register at bit.ly/CS4FN-MAGIC1

The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Paul Curzon Queen Mary University of London

The Magic of Computer Science (Part I)

teachinglondoncomputing.org/magicofcs/

Please register at bit.ly/CS4FN-MAGIC1

Page 2: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Computer Science is about computation (not computers)

• Computational thinking is a way of solving problems you learn as a computer scientist

Page 3: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Magic = Computation

• Magic is based on science, maths and engineering.

• It is computation.

• Magicians and Computer Scientists think the same way

Computational Thinking3

Page 4: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

On to the magic … Please keep the secrets

• I’m going to teach you to do the tricks

• If you do perform them later for friends don’t break the magician’s code

• If you do know then don’t shout out – let others puzzle it out first!

4

Page 5: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Invisible Palming

15

Page 6: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Ponder break

How on earth do they do

that?

6

Page 7: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

The magical instructions

1

1. Put two cards between each finger of the volunteer saying “2 cards make a pair”

2. Place the final card alone

3. Collect them up a pair at a time splitting the pairs into two piles

4. Ask the volunteer to choose where to put the extra single card

5. Put the card there

6. Pretend to move it invisibly from one pile to the other

7. Deal cards from pile 1 in pairs showing the extra card has gone

8. Deal cards from pile 2 in pairs showing the extra card is there

7

Page 8: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

It’s an algorithm That’s all programs are too

1

• An algorithm is: – Instructions to be followed in order

– that do something you want done

• Programs are: – Algorithms for computers to follow

• Magic tricks are: – Algorithms for magicians to follow

8

Page 9: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Activity 2

1

• In the Google doc at bit.ly/CS4FN-MAGIC1

write down what you think

ALGORITHMIC THINKING is.

9

Page 10: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Algorithmic Thinking is:

1

• Thinking of solutions AND other situations as algorithms

• steps to blindly follow – to guarantee a result – to get answers – to simulate a situation – to run experiments

10

Page 11: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Algorithmic Thinking is:

1

• Devising algorithms

• Making sure it always works

• Thinking through ALL possibilities

• Attention to detail

• Writing the instructions in a precise language

11

Page 12: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Programmers really are wizards!

Magic = algorithm + presentation

Software = algorithm + presentation

Both the algorithm and the presentation (the interface) must work well

12

Page 13: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

The Magical Wizardly

Book

13

Page 14: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

• Wizardly books have magical powers.

• Books like ‘The Wizard of Oz’ and ‘Macbeth’ can control your mind!

Magical Books

14

Page 15: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife.

Circle a word from the firstsentence of the Wizard of Oz

The start of The Wizard of Oz

15

Page 16: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Dorothy lived in the midst of the great Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who was the farmer's wife.

Their house was small, for the lumber to build it had to be carried by wagon many miles.

There were four walls, a floor and a roof, which made one room; and this room contained a rusty-looking cooking stove, a cupboard for the dishes, a table, three or four chairs, and the beds.

Stop as soonas you hit a red word

Repeatedly count the number of letters and thenjump on that many words and circle the new word

Circle a word from the firstsentence

16

Page 17: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Ponder break

How on earth do they do

that?

17

Page 18: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

It always works…(of course!)

• You will always end up at that word• It actually works for just about any

book…• if you keep going far enough

18

Page 19: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

The magic algorithm…

• Circle a word from the first sentence.• Repeatedly

• Count the number of letters in it. • Jump forward that many words.• Circle that word.stopping when you hit a red word

19

Page 20: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Let’s see how it works by looking at Macbeth

20

Page 21: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

When shall we three meet againIn thunder, lightning, or in rain?

Circle a word from the firstsentence of the Macbeth

The start of Macbeth

21

Page 22: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

When shall we three meet againIn thunder, lightning, or in rain?

When the hurlyburly's done,When the battle's lost and won.That will be ere the set of sun.Where the place?

Upon the heath.There to meet with Macbeth.

Stop as soonas you hit a red word

Repeatedly count the number of letters and thenjump on that many words and circle the new word

Circle a word from the firstsentence

22

Page 23: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

• Either do this with pencil and paper OR• Go to the Google Doc (bit.ly/CS4FN-MAGIC1)

for a link to an online drawing package drawing

• Make a copy and do it there

Activity 4

23

When shall we three meet again

in thunder lightning or in rain

Page 24: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

• We need to check it ALWAYS works• in a way so we can DOUBLE CHECK

• DRAW ARROWS to show the jump from word to word (until you get to a red word).

• Do it for every word in the FIRST sentence.

How can we be sure?

24

When shall we three meet again

in thunder lightning or in rain

Page 25: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

25

Showing it always worksWhen shall we three meet again

in thunder lightning or in rain

When the hurlyburlys done

When the battles lost

and won

That will be ere the set

Where the place

of sun

Upon the heath

Page 26: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

26

Not as many paths as you thought!

Page 27: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

27Merged paths stay merged

Page 28: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

28

Logical Thinking

Page 29: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Evaluation• We have checked the algorithm always works.• This is the part of computational thinking

called EVALUATION• Do the same for programs• Important to check all possibilities.• Both magicians and computer scientists have

to think clearly and precisely.

• Check The Wizard of Oz always works too.29

Page 30: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Testing v Logical Thinking

You can evaluate an algorithm by trying to test every path through it

Or you can use logical thinking to cut down the amount of testing needed.

30

Page 31: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Programmers really are wizards!

• Programmers and magicians have to think in the same way – creating new tricks, – creating new programs

Magic = algorithm + presentation

Software = algorithm + presentation

31

Page 32: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Design for people making mistakes

• EVERYONE makes mistakes

• Design programs to help people avoid the problems!

You will save more lives than any doctor that wayComputational thinking is problem solving for people!

32

Page 33: The Magic of Computer Science (Part I) · • Magicians and Computer Scientists think the same way Computational Thinking 3. On to the magic … Please keep the secrets • I’m

Thank you

Resources on magic and computer science at: teachinglondoncomputing.org/magicofcs/

33

Please fill in the feedback form at the end of the Google Doc

bit.ly/CS4FN-MAGIC