DIGITAL LIBRARY
USING MAGIC TO TEACH COMPUTER PROGRAMMING
1 University of Illinois Chicago (UNITED STATES)
2 Loyola University Chicago (UNITED STATES)
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:

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/