! Denver, CO! Demystifying Computing with Magic, continued

Similar documents
The Sweet Learning Computer

Mathematical Magic for Muggles April 16, 2013

Introduction to Auction Theory: Or How it Sometimes

Binary Games. Keep this tetrahedron handy, we will use it when we play the game of Nim.

Bouncy Dice Explosion

Mathematical Magic Tricks

Is muddled about the correspondence between multiplication and division facts, recording, for example: 3 5 = 15, so 5 15 = 3

A few chessboards pieces: 2 for each student, to play the role of knights.

Analyzing Games: Solutions

Building Successful Problem Solvers

Lecture 1, CS 2050, Intro Discrete Math for Computer Science

LEARNING ABOUT MATH FOR GR 1 TO 2. Conestoga Public School OCTOBER 13, presented by Kathy Kubota-Zarivnij

Games of Skill Lesson 1 of 9, work in pairs

Second Annual University of Oregon Programming Contest, 1998


CS 4700: Artificial Intelligence

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

Junior Circle Meeting 5 Probability. May 2, ii. In an actual experiment, can one get a different number of heads when flipping a coin 100 times?

CS1802 Week 9: Probability, Expectation, Entropy

Bouncy Dice Explosion

MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability. Preliminary Concepts, Formulas, and Terminology

Roll & Make. Represent It a Different Way. Show Your Number as a Number Bond. Show Your Number on a Number Line. Show Your Number as a Strip Diagram

Dependence. Math Circle. October 15, 2016

Games of Skill ANSWERS Lesson 1 of 9, work in pairs

CS1800: More Counting. Professor Kevin Gold

Introduction to Counting and Probability

Solution Algorithm to the Sam Loyd (n 2 1) Puzzle

Game Theory and Algorithms Lecture 19: Nim & Impartial Combinatorial Games

Section 6.1 #16. Question: What is the probability that a five-card poker hand contains a flush, that is, five cards of the same suit?

Three Pile Nim with Move Blocking. Arthur Holshouser. Harold Reiter.

Grades 7 & 8, Math Circles 27/28 February, 1 March, Mathematical Magic

Probability is often written as a simplified fraction, but it can also be written as a decimal or percent.

Grade 7/8 Math Circles February 9-10, Modular Arithmetic

7 adult, especially good for younger groups

Grade 7/8 Math Circles Game Theory October 27/28, 2015

An Amazing Mathematical Card Trick

Mathematical Magic for Muggles April 16, 2013

Circular Nim Games. S. Heubach 1 M. Dufour 2. May 7, 2010 Math Colloquium, Cal Poly San Luis Obispo

LISTING THE WAYS. getting a total of 7 spots? possible ways for 2 dice to fall: then you win. But if you roll. 1 q 1 w 1 e 1 r 1 t 1 y

Problem Set 8 Solutions R Y G R R G

completing Magic Squares

To Your Hearts Content

Taking Sudoku Seriously

Solutions for the Practice Final

You ve seen them played in coffee shops, on planes, and

Tangent: Boromean Rings. The Beer Can Game. Plan. A Take-Away Game. Mathematical Games I. Introduction to Impartial Combinatorial Games

Senior Math Circles February 10, 2010 Game Theory II

Use the following games to help students practice the following [and many other] grade-level appropriate math skills.

SOME MORE DECREASE AND CONQUER ALGORITHMS

Grade 6 Math Circles. Math Jeopardy

8.2 Union, Intersection, and Complement of Events; Odds

Kenken For Teachers. Tom Davis January 8, Abstract

Modular Arithmetic and Doomsday

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

LEARNING ABOUT MATH FOR K TO 5. Dorset Public School. April 6, :30 pm 8:00 pm. presented by Kathy Kubota-Zarivnij

Problem Set 8 Solutions R Y G R R G

The Problem. Tom Davis December 19, 2016

The Teachers Circle Mar. 20, 2012 HOW TO GAMBLE IF YOU MUST (I ll bet you $5 that if you give me $10, I ll give you $20.)

MITOCW watch?v=-qcpo_dwjk4

JUSTIN. 2. Go play the following game with Justin. This is a two player game with piles of coins. On her turn, a player does one of the following:

Mathematics. Programming

Math Circles 9 / 10 Contest Preparation I

November 8, Chapter 8: Probability: The Mathematics of Chance

BMT 2018 Combinatorics Test Solutions March 18, 2018

Three of these grids share a property that the other three do not. Can you find such a property? + mod

UNIT 13A AI: Games & Search Strategies. Announcements

EECS 203 Spring 2016 Lecture 15 Page 1 of 6

Error-Correcting Codes

Jeremy Beichner MAED 591. Fraction Frenzy

The Factor Game (gr. 3-5) Product Game (gr. 3-5) Target Number (exponents) (gr. 4-5)

Maths Is Fun! Activity Pack Year 6

2016 Confessions of an Empty Cubicle

of Nebraska - Lincoln

CS256 Applied Theory of Computation

Background. Game Theory and Nim. The Game of Nim. Game is Finite 1/27/2011

THE ASSOCIATION OF MATHEMATICS TEACHERS OF NEW JERSEY 2018 ANNUAL WINTER CONFERENCE FOSTERING GROWTH MINDSETS IN EVERY MATH CLASSROOM

UK JUNIOR MATHEMATICAL CHALLENGE. April 26th 2012

Grade 6 Math Circles March 7/8, Magic and Latin Squares

Sept. 26, 2012

Plan. Related courses. A Take-Away Game. Mathematical Games , (21-801) - Mathematical Games Look for it in Spring 11

November 6, Chapter 8: Probability: The Mathematics of Chance

Contents. MA 327/ECO 327 Introduction to Game Theory Fall 2017 Notes. 1 Wednesday, August Friday, August Monday, August 28 6

Name: Probability, Part 1 March 4, 2013

GRADE 3 SUPPLEMENT. Set C3 Geometry: Coordinate Systems. Includes. Skills & Concepts

Problem A To and Fro (Problem appeared in the 2004/2005 Regional Competition in North America East Central.)

28,800 Extremely Magic 5 5 Squares Arthur Holshouser. Harold Reiter.

PROBLEMS & INVESTIGATIONS. Introducing Add to 15 & 15-Tac-Toe

TEST A CHAPTER 11, PROBABILITY

Game, Set, and Match Carl W. Lee September 2016

Crossing Game Strategies

Mind Ninja The Game of Boundless Forms

Year 6. Mathematics A booklet for parents

Subtraction Step Down

Let start by revisiting the standard (recursive) version of the Hanoi towers problem. Figure 1: Initial position of the Hanoi towers.

Here is a great game to help Teach Addition and Subtraction!

I.M.O. Winter Training Camp 2008: Invariants and Monovariants

Chapter 10 Error Detection and Correction 10.1

Chapter 11: Probability and Counting Techniques

Presentation by Toy Designers: Max Ashley

The Sixth Annual West Windsor-Plainsboro Mathematics Tournament

Transcription:

2012-03-07! Denver, CO! Demystifying Computing with Magic, continued

Special Session Overview Motivation The 7 magic tricks ú Real-Time 4x4 Magic Square ú Left/Right Game ú The Tricky Dice ú The Numbers Game ú Find the Card ú Guess Your Age ú Guess Your Birthday Day of Week Reflection Other References YOU contribute your tricks Demystifying Computing with Magic, continued 2/42

Demystifying Computing with Magic, continued 3/42

Demystifying Computing with Magic, continued 4/42

Magic can Motivate, Illustrate, Elaborate Computing notions ú Discrete math terms: e.g., permutations, ú Problem representation: e.g., binary digits ú Algorithmic patterns: e.g., sorting ú General notions: e.g., symmetry Problem solving ú Problem decomposition ú Simplification, Generalization ú Backward reasoning ú Analogy (transfer) ú Problem representation Demystifying Computing with Magic, continued 5/42

Real-Time 4x4 Magic Square Volunteer is asked for a number N from 25-100 You create a magic square, where the sum of each row, column and diagonal is N Source: All add to N N N N Demystifying Computing with Magic, continued N N N N N N 6/42

How it Works; What Students Learn Mechanics ú Make-Magic-Square(N) ú Have a grid with the value already written faintly (or memorize it) What they learn ú Value of lookup table ú Correctness proof ú Decomposition ú Algebraic representation ú Value of randomness 8 rotations-and-flips N-20 1 12 7 11 8 N-21 2 5 10 3 N-18 4 N-19 6 9 N N N N N N N N N N Demystifying Computing with Magic, continued 7/42

A line of 2N integer cards Two players, alternating turns Each player, on her turn, takes a card from one of the line ends (left or right) The winner is the player whose sum of N cards is larger

A volunteer from the audience arranges the line of 2n cards as she wishes The magician looks at the line for a few seconds; then turns his back to the cards The player plays against the magician, while the magician does not see the line of cards The magician is the 1 st player, never loses

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 3! Take the larger end But, maybe the larger end yields a good move for the opponent?

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 3! Take the card from the end with the better delta But, is it sufficient to look locally?

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 3! Identify the locations of the larger cards, and try to get these cards But, how to guarantee getting them?

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 3! 5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 3! Apply dynamic programming - solve the game for: all pairs, all triples, all quadruples

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 3! Not simple to program Requires O(N²) time, O(N) space (or even O(N²) space, if not experienced)

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 3! Employ divergent thinking / creativity The game involves selection from alternative locations; so maybe look, for a moment, only on locations and not on values

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 3! The leftmost card is initially in an odd location and the rightmost card in an even location If the leftmost card is removed, then the two ends will be initially-even locations (2 nd, 12 th )

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 3! If the leftmost card is removed, then the two ends will be initially-even location (2 nd, 12 th ) If the rightmost card is removed, then the two ends will be initially-odd location (1 st, 11 th )

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 6! After I remove the card from the 1 st location, both ends will be the 2 nd and 12 th locations; after my opponent will remove a card, there will again be an end of an initially-odd location; I may remove it, and again leave ends of initially-even locations

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 6! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 6! 3! 9! 8! 4! 7! 5! 1! 2! 9! 6! 8! 4! 7! 5! 1! 2! 9! 6! 9!

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 6! Following the above, I may play as follows: after each of my turns, both ends will be initially-even locations, or: after each of my turns both ends will be initially-odd locations

5! 9! 8! 4! 7! 5! 1! 2! 9! 6! 3! 6! Sum separately the values in the even locations (here 32) and the values in the odd locations (here 33). Then, start with the end of the higher sum, and just imitate the opponent s moves

Greedy algorithms (be careful ) Dynamic programming Invariance Values vs locations (addresses) Divergent thinking

The Tricky Dice Participant puts dice in a glass ú Magician guesses the numbers on the bottom Source: Math Magic 1 and 4 Demystifying Computing with Magic, continued 23/42

How it Works; What Students Learn Mechanics ú Opposite die sides sum to 7 ú Answer is (7-die 1, 7-die 2 ) Mirror Students Learn ú Good design (in how the pips on a die are chosen) ú Simple algorithm ú Complements Demystifying Computing with Magic, continued 24/42

The Numbers Game Participant calls out 10 numbers ú Magician writes numbers on paper, turns them over ú Participant picks random one, magician guesses number Source: CS4FN www.cs4fn.org/magic/numbersgame.php 49, 124, 5, 6, 8, 19, 233, 69, 1, 99 49 Demystifying Computing with Magic, continued 25/42

How it Works; What Students Learn Mechanics ú Write 1 st number on all cards. ú You never promised anything more than that! Students Learn ú HCI design principle You developed a mental model That wasn t how things worked It s important to make the critical parts of the internal system visible to the user so they see what state it s in. 49, 124, 5, 6, 8, 19, 233, 69, 1, 99 49! 49! 49! 49! 49! 49! 49! 49! 49! 49! Demystifying Computing with Magic, continued 26/42

A volunteer from the audience arranges the cards 1..N in some permutation Magician-1 looks at the line for a few seconds; leaves it as is, or swaps two cards Magician-2 enters the room, and the audience calls out any of the integer 1..N Magician-2 finds the called integer in at most N/2 attempts

9! 8! 4! 7! 5! 1! 2! 10! 6! 3! Each value is in the range of the card locations; look at values as pointers (?) 9! 8! 4! 7! 5! 1! 2! 10! 6! 3! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10!

9! 8! 4! 7! 5! 1! 2! 10! 6! 3! 9! 8! 4! 7! 5! 1! 2! 10! 6! 3! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10! Each card points-at exactly one other card, and is pointed-by one other card

9! 8! 4! 7! 5! 1! 2! 10! 6! 3! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10! Each card is in exactly one cycle; the card in the i th location is in a cycle with the card whose value is i, which is it s predecessor in the cycle

9! 8! 4! 7! 5! 1! 2! 10! 6! 3! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10! Thus, we may reach the card with value i, by following the pointers starting from the i th card; the amount of work will be the length of the cycle that we follow

9! 8! 4! 7! 5! 1! 2! 10! 6! 3! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10! There may be at most one cycle of length larger than N/2; if such a cycle exists, then we may break it into two cycles, by swapping two of its pointers

9! 8! 4! 7! 5! 1! 2! 10! 6! 3! 9! 8! 4! 7! 5! 1! 2! 10! 6! 3! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10! Swap the cycle s middle with its start 9! 4! 8! 7! 5! 1! 2! 10! 6! 3! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10!

9! 4! 8! 7! 5! 1! 2! 10! 6! 3! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10! So, if there is a cycle of length larger than N/2, break it after at most N/2 hops into two smaller cycles; each of the cycles will not exceed the length of N/2

Values as locations (pointers) Cycles of values in a permutation A cycle may be broken into two cycles by swapping the locations of two of its pointers Divergent thinking

Guess Your Age Volunteer is handed several cards with random numbers written on them ú Returns the cards with age listed on them Magician glances and says the person s age Source: Math Magic A 8 9 10 11 12 13 14 15 B 4 5 6 7 12 13 14 15 C 2 3 6 7 10 11 14 15 D 1 3 5 7 9 11 13 15 13 A, B, D Demystifying Computing with Magic, continued 36/42

How it Works; What Students Learn Mechanics ú Every card is a column in the binary table E.g., 2 1 = 2 card has { 2, 3, 6, 7, 10, 11, 14, 15 } ú The first number in the list is the number of the card. ú Just add those together Students Learn ú Intro to Algorithms ú Binary numbers ú Encoding ú Lookup table for quick calc! Demystifying Computing with Magic, continued A B C D N 2 3 2 2 2 1 2 0 0 0 0 0 0 1 0 0 0 1 2 0 0 1 0 3 0 0 1 1 4 0 1 0 0 5 0 1 0 1 6 0 1 1 0 7 0 1 1 1 8 1 0 0 0 9 1 0 0 1 10 1 0 1 0 11 1 0 1 1 12 1 1 0 0 A, B, D 13 1 1 0 1 8+4+1 14 1 1 1 0 15 1 1 1 1 13 37/42

Guess the birthday day of the week Volunteer is asked for their birthday Magician says what day of the week it was Source: en.wikipedia.org/wiki/zeller%27s_congruence! June 23, 1912 Thu Demystifying Computing with Magic, continued 38/42

How it Works What they learn: Don t nec generalize ú Alg, value of lookup table, modulo Y Mechanics ú Complicated general alg: ú Easier: M, D, Y in 1900s Turing: June 23, 1912 (6/23/12) Sunday! Algorithm Y/4%7 0 0 20 5 40 3 60 1 80-1 ú If M =1 or 2, Y = Y - 1 ú (F(M) + D + Y + Y/4) % 7 1-index: 1=Mon, 2=Tue, etc. Y/4 fast by 20s: 0,5,3,1,-1 ú Example (4+23+12+3) % 7 (4 + 2 + -2 + 3) = 7 (Sunday!) M F(M) My memory trick 1 1 1 and 3 pass through 2 4 24 hours in a day 3 3 1 and 3 pass through 4 6 4-6 are flips 5 7 Heinz 57 sauce 6 4 6-4 are flips 7 6 Spirit of 76 8 2 8 is made up of 2s 9 5 Working 9-to-5 10 0 Only # with 0 is 0! 11 3 11 in Binary is 3 12 5 Working 12-5 (afternoons) Demystifying Computing with Magic, continued 39/42

Great Resource : CS4FN Paul Curzon, Peter McOwan, Jonathan Black @ Queen Mary, University of London ú CS4FN magazine ú Two free books on Magic and CS! ú Some online apps If you d like to contribute tricks, contact them Demystifying Computing with Magic, continued 40/42

Great Resource : Math Magic www.parents-choice.org/product.cfm?product_id=29300! Kids Labs, $12 They include dice, cards, calculator, templates, ú Some of our tricks we demonstrated today were from this great resource! Demystifying Computing with Magic, continued 41/42

Motivate, Illustrate, and Elaborate on: - Computing notions - Problem solving - Divergent Thinking Audience Participation Do YOU have any magic to share?