Becoming Strange
What if the most accurate model for understanding a spell — is a function?
Doctor Strange (2016) — Marvel Studios & the Ancient One
Doctor Strange (2016, directed by Scott Derrickson) tells the origin story of Stephen Strange — a brilliant but arrogant neurosurgeon whose hands are destroyed in a car accident. Unable to heal them through conventional medicine, he travels to Nepal seeking the Ancient One, a centuries-old sorcerer played by Tilda Swinton.
“You’re a man looking at the world through a keyhole. You spent your whole life trying to widen that keyhole. To see more, to know more; and now, on hearing that it can be widened in ways you can’t imagine… you reject the possibility.” — The Ancient One, Doctor Strange (2016)
The scene featured here is Strange’s first real lesson. The Ancient One does not begin with theory. She begins with a demonstration: she pushes Strange’s astral form out of his body and sends him rocketing through dimensions he had no framework to describe. It is, deliberately, a showing before a telling. Students recognize the rhythm: see the result first, understand the mechanism second.
When Strange demands to know how she did it, the Ancient One’s answer is precise: “Spells. Sorcerers cast spells.” A spell, in her framing, is a structured sequence of gestures and intentions that, when executed in the correct order with the correct parameters, produces a predictable effect on the world. Change the parameters, change the effect. Miss a step, break the spell. Call it with the wrong inputs, and the result is chaos — or nothing at all.
“The language of the mystic arts is as old as civilization. The sorcerers of antiquity called the use of this language spells. But if that word offends your modern sensibilities you can call it a program, the source code that shapes reality. We harness energy…drawn from other dimensions of the Multiverse…to cast spells…to conjure shields…and weapons…to make magic.” — The Ancient One, Doctor Strange (2016)
That is a function. Not a metaphor for a function. Not an analogy that requires translation. In the world the film builds, a spell and a function are the same architectural idea: a named, parameterized sequence of instructions that transforms an input state into an output state. The multiverse is just a very large runtime.
This is why the scene is in a computer science classroom: it re-frames an idea students may find abstract — the function — in terms they find immediately vivid. After Strange, when students write drawShield(cx, cy, radius) and see rings appear on a canvas, they are not writing code. They are casting a spell. The source file is the grimoire.
CS Connection — Spells, Functions, and the Mystic Shield
The Ancient One does not leave the parallel implicit. She names it directly: “If that word offends your modern sensibilities you can call it a program, the source code that shapes reality.” That sentence is the entire lesson plan. Her curriculum maps onto three things every CS student needs to understand about functions:
-
A function is a named sequence.
Strange cannot cast a spell by willing it into existence; he must learn the exact
movement in the exact order. A function call does not execute whatever the programmer
hopes for — it executes the exact sequence written in the definition.
drawShield(400, 300, 180) does exactly what
drawShieldwas written to do at position (400, 300) with radius 180. No more, no less. - Parameters determine the effect. The same spell with different targets produces different outcomes. castPortal(destination, size) opens a window to Hong Kong or Kamar-Taj depending on the argument. The logic is the same; the inputs change everything.
- Abstraction hides complexity. Strange does not need to understand the physics of dimensional folding to open a portal. A student calling blendMode(ADD) does not need to understand GPU compositing to produce a glowing overlay. The function name is the thing the caller knows. The implementation is what the function hides.
The Interactive Mystic Shield app on this page is a direct descendant of this lesson. It is a p5.js sketch that draws a glowing mandala over a base image: concentric rings, rotating satellite sigils, particle sparks, and energy tethers. Move the mouse and the shield responds. Hold the mouse and it tilts into a perspective ellipse. The entire effect is produced by function calls: drawRings(), drawStarGeometry(), drawSparks(). Students who open the source code see exactly what the Ancient One meant: spells are programs.
Movie clip is only available in larger viewports.
On some mobile devices, rotating to landscape will allow viewing.