DIGITAL LIBRARY
USING MAGIC TO TEACH COMPUTER PROGRAMMING
1 University of Illinois Chicago (UNITED STATES)
2 Loyola University Chicago (UNITED STATES)
About this paper:
Appears in: EDULEARN22 Proceedings
Publication year: 2022
Pages: 3240-3248
ISBN: 978-84-09-42484-9
ISSN: 2340-1117
doi: 10.21125/edulearn.2022.0794
Conference name: 14th International Conference on Education and New Learning Technologies
Dates: 4-6 July, 2022
Location: Palma, Spain
Abstract:
Magic can be used in project-based instruction to motivate students and provide a meaningful context for students learning computer programming. This work describes two “magic” programs, of the “Guess a Number” or “Mind-reader” variety, making connections to the underlying computing concepts.

The science fiction writer Arthur C. Clarke wrote that “any sufficiently advanced technology is indistinguishable from magic.” As technology continues to grow at an exponential rate, new applications regularly arise that surprise us in what they can do. We capitalize on this trend by creating assignments and demonstrations that are magical, captivating students’ attention so that they want to understand and replicate these themselves, showing them to their friends and family. This investment of attention motivates students to invest in learning the underlying programming concepts.

The first example presents a table of numbers, where each one is associated with a seemingly random letter. Participants choose an initial number and then do some simple math to find a second number. The program then tells them which letter is next to their number. In the second example, a student volunteer chooses a secret number, such as the age at which they hope to market a wildly successful app. The volunteer is then presented with six boxes with numbers in them, and asked to indicate which boxes have their number. The presenter then guesses their number. Each of these examples illustrates computing concepts, and can be used in classroom explanations or programming assignments.

In this paper we present several magic tricks and programming exercises that students can complete to implement these tricks and explore these phenomena. Starting from the two tricks discussed above that we will demonstrate, we will include a list of resources:

1. The magic square example given in the demonstration:
https://sites.google.com/view/bttcs111sp22/assignments/program-3-magic-square which includes a link to play it online at http://bit.ly/uicmindreader

2. A variation of the demonstrated “Six Boxes” problem is at http://www.cs4fn.org/mentalism/cardsonyourmind.php

3. Card grid used to illustrate error-detecting codes:
a. Inspired by https://www.csunplugged.org/en/topics/error-detection-and-correction/integrations/quick-card-flip-magic/
b. Play online at: https://sites.google.com/site/cstaniftyassignments/home/2020/dale-reed-memory-trainer
c. Additional extensions and online implementations available at https://rig.cs.luc.edu/~rig/errdetectmagic

4.Transitive dice, where no matter which die your opponent chooses, your choice beats theirs on average: https://sites.google.com/site/uiccs141fall2018/programs/prog-1-dice

5. Replicating card tricks in a computer program (and many more excellent ideas) at http://www.cs4fn.org/magic/. See also https://www.dropbox.com/s/atfj8e82widmcie/Program%204%20Mystery%2021.html?dl=0

6. Guess a number, and the computer will find it:
a. https://sites.google.com/site/cs141spring2017/programs/prog-1-guess-num
b.Choose a number between 0 and 50,000, and the computer guesses it using a technique known as "binary search".

7. Many AI or pattern-matching programs can seem like magic, such as Google’s QuickDraw or 20 Questions. See if the computer can out-guess you in a simple 0/1 guessing game, playing online at: https://sites.google.com/site/cstaniftyassignments/home/csta-nifty-2018/dale-reed-number-guess
Keywords:
Magic, Programming, STEM, Binary, Parity, Search, Card, Number Guess, Dice.