Rendering of cards

The tarot of Programming

As a student, I did play a lot of tarots (the card game), but never really dabbled into the occult of divination methods. Yet, a few random coincidences (or perhaps fate?) instilled in me the idea of a tarot deck for programmers. This was the excuse I needed to play AI-generated art, and experiment with MidJourney.

There are times, when coding, and especially when debugging, when you get faced with a seemingly intractable problem or with a bug that seems so puzzling that you may be willing to shed all rationality and call upon the supernatural. This tarot deck, crafted not by ancient wizards or alien beings, but by a thinking computer with the power of a thousand brains, is here for these cases. Just draw a card, and let the Universe tell you how to solve your problem! Of course, it’s healthy to remain skeptical of the magical property of a deck of cards, however hermetic its imagery, but maybe your imagination and the power of free association is the real magic all along.

Interpreting the cards

I. the Infinite Loop

Limitless possibilities await the young programmer, but beware the traps of an endlessly grinding program! While it’s true that infinite loops are often to be avoided, they can be useful for catching events or maintaining daemons awake. Check your exit conditions, or recurse all the way down.

This card draws on the Magician (or Juggler), the first arcane, and its association with the infinite sign, as well as youth, inexperience and being a novice in the occult arts.

II. the Analyst

A program sometimes solely exist in the mind of its creator, but one day, someone else will need to comprehend it. Write down. Document. Clarify. Read the manual. Think of the programmer of yore, who has to peruse ancient treatises, or write programs for computers existing only in their minds!

This cards depicts Ada Lovelace, arguably the first computer programmer in history, who first conceived of a program for the Analytic Engine, a computer that didn’t yet exist. She stands in for the Priestess, a card representing study and knowledge, encouraging you to document your code.

III. the Bug Tracker

With the first compiler came the first bug. Bugs can cause chaos and spell disaster. Yet bugs can be beautiful and inspiring. We must track them, so that we know them better. Sometimes a bug is a feature. And sometimes, you must pull a fried moth from the relays.

Another pioneer of computing, Admiral Grace Hopper worked on the first compilers and linkers in the 1960s. In one documented occasion, a moth jammed itself in the circuits of her machine; which has popularized the use of bug as slang for a computer problem. With an distinguished military and scientific career, her arcane is the Empress, a woman of power. Get those bugs !

IV. the Professor

From his chair, this modern computer science professor guides you through the hard technical questions. Have you carefully designed your data structures? Have you considered the complexity of your algorithms? Trees can be fruitful and hashing can be perfect. Or you might want to spend 8 years on a side project.

The Professor represents Donald Knuth, legendary computer science scholar and author of The Art of Computer Programming, a definitive textbook on algorithms and data structures. Such an authority in the domain could only take the place of the Emperor, the card symbolizing mastery and wisdom.

V. the Evangelist

Good Words spreads. Freedom rings. Causes are worthy to be upheld, and consequences better be considered. To fight the system, you must step out of it, use its weapons against itself, but not compromise your moral values. Fight for the users, fight for the herd.

Taking the place of the Hierophant – the high priest- is Richard ‘rms’ Stallman, the indefatigable activist championing the cause of Free Software, the GNU project and the GPL, who sometimes wears the costume of “Saint iGNUcius”.

VI. the Fencepost Error

The first man who put a fence in a forest likely miscounted the number of posts. Did you start from zero or one? Do you stop before or after? Do you do one more iteration? Or one less ? This cards tells you to check your counts.

In the tarot de Marseille, the 6th arcane, the Lovers, depicts one man confronting two women; in other decks, it shows Adam and Eve in the garden of Eden. The fencepost error or off-by-one error is a classic mistake of counting one too many iterations (to put up n links of fence, you need n+1 posts), where you might end up with one more (or one less) that you expected.

VII. the Race Condition

The cart must come before the horse, or is it the other way around ? Threads spawn, promises await and locks spin. You must ask yourself : what is the point of a race you can’t win ? You must be faster, or smarter, or maybe use a mutex.

The seventh arcane is the Chariot, which depicts two horses going in different directions. I chose it to illustrate a race condition, a category of subtle category of concurrency problems which occur in parallel programming.

VIII. the Load Balancer

For justice to be served, it must be well balanced. The Great Equalizer, Scheduler of Tasks, Stealer of Jobs. Think of how work is to be distributed. Think about equality, about balance, about justice. Think about fairness, reduce bias, erase errors.

In and distributed systems, load balancing is the distribution of work across multiple resources, so that each resource is used. Any large scale service sits behind a load-balancer, as operating system process get ordered by a scheduler, whose job it is to avoid exhausting resources. A good fit for the arcane of Justice.

IX. the Rubber duck

Those who can, do; those who can’t, explain; those who explain, eventually do it. Get out there and talk, to friend, colleague, family, or, yes, rubber duck. He will show you the way, shedding some light from outside the box. It may not quack like a duck, but it will help you out of any ducking type of problem.

Rubber-ducking is the technique of trying to explain a bug or a problem, canonically to a rubber duck toy on one’s desk, in the hope that speaking out the details will bring a new understanding or a solution. It takes the role of the Hermit, a card that symbolizes using meditation or esoteric methods to gain new knowledge.

X. the RNG

Fortune has plenty in store for you, if you have the coin… Hides your secrets, makes you unique, beats the house at Monte-Carlo, critically hits. Twister of fate, give us entropy, but only the good bits !

Random Number Generators are essential components of computer systems, from cryptography to simulation to games, and can be tricky to implement correctly; which fits perfectly with the original card, the Wheel of Fortune, which represents chance and randomness.

XI. Brute Force

Every lock has its key; if in doubt, try them all ! Sometimes simplicity is just trying to do the same thing a billion times and expecting that the result will be different. Just don’t wait until the end of the universe.

The eleventh card, standing in for Strength, is about brute force, that is trying every possible solution, or every possible answer, until finding one that works. Not subtle, but guaranteed to work, at least with enough time.

XII. Pointer

Dangling on its thread, the pointer only shows you the way to the next link. Follow it, for indirection solves all problems. Don’t lose it, or you might smash your stack, go out of bounds, or even get killed. Go deep and check your limits, beware of overflows, and shun the corruption. Use the sharp point of pointers with caution!

Pointers are everywhere in low-level languages like C and in data structure design. For many students, understanding pointers is the first hurdle they have to overcome in their programming curriculum. Its original tarot counterpart, the Hanged Man, shows a direction (with their foot !), dangling off a rope (which for pointers is pretty dangerous) and symbolizes getting new insights.

XIII. Deadlock

Somber snakes symmetrically surround skull, as intentional intertwining interrupts improvement, inhibiting initiative. Beware of the dead lock ! Give priority, break symmetry, create order, or suffer the deadly embrace of immobility.

One of the most ominous, arcane number thirteen is often not named, but very obviously depicts Death or a Grim Reaper figure. Here, it stands for a deadlock, a spooky bug where two threads or programs are waiting on each other to do something, blocking them both forever.

XIV. Memory Leak

Pour one byte for the gods, and remember where your memory is. Powerful is the urge for a program to consume all. Be smart, or be unique. Beware of weak references, of endless cycles, of freedom doubly granted, or the ill-fated cache miss. Get your fill and then some more, and let the garbage collector take its due.

Temperance, arcane number fourteen, is all about good measure and careful use, which is the exact opposite of a memory leak, when memory (or more generally any resource) is allocated, but never released after being used, preventing other programs to access it.

XV. The Hacker

Anonymous evil, blower of holes, breaker of cyphers, the hacker is here to wreck your system. Or is he taking it apart to build something better ? Destruction breeds creation; barriers call for workarounds; restriction enhance creativity. Hack the planet !

The hacker is ambivalent: for most people it’s the equivalent of a computer criminal, a pirate or cracker, but at it’s origin in early computer folklore, it was describing a creative type of technical problem-solver. And thus this arcane replaces the Devil, a card with a sulfurous reputation that can also represent creativity, empowerment and freedom.

XVI. Server Fault

Woe betides who builds a tower in the clouds without solid foundations ! Power sources shall be struck by lightning, archives shall be erased, brains shall be split, necks shall be bottled, failures single-pointed. And hast thou checked they who serve your names ?

One of the more ominous arcane, the Lighting-struck tower is said to announce disaster. Likewise this card warns you about so many possible errors that befall servers and other network infrastructure, including actual lightning striking your data center (thankfully we now have uninterruptible power supplies).

XVII. A*

Open the set of possibilities. Along the path with the widest tree, search deeply and you will find closure. Maximize your flow, and minimize your cuts. With a star as your guide, your traversal will be speedy. Cross the seventh bridge into the dual space.

The A* algorithm finds the shortest path between two nodes in a graph. The card highlights the ubiquitous presence of graph theory in computer science. From GPS to routers, from video games to discrete optimization, graphs and paths illuminate computing. It replaces, of course, the Star card.

XVIII. Heisenbug

Alive or dead, fast or slow, here or there, now or never. Where is the bug ? Is it in the mind of the machine or in the mind of the programmer ? Everything exists in a precarious superposition where it works and doesn’t at the same time. Observe the delicate balance with minimal intervention, or watch it collapse.

One of the most pesky class of bugs, a Heisenbug is a bug that disappears when being debugged, alluding to the famous uncertainty principle of quantum physics; inspiring other fancy categories such as Schrödingbug or Bohr bug. It replaces the Moon arcane, one of the most mysterious cards, and depicts an evanescent Schrödinger cat.

XIX. Virtual machine

I once dreamed I was a machine. A machine who could dream. And it dreamed that it was a machine. Three billion machines watched the sun rise, each one a universe of its own. There was a night, there was a morning: the first cycle.

A virtual machine is a computer simulated by another computer, an idea that appeared in the mind of Turing at the foundation of theoretical computer science. Since then it has found use into data centers, video game emulators, for sandboxing processes or even as programming language runtime ; the card picture alludes to the latter, as it stands in for the Sun arcane.

XX. Logs

When all was said and done, there were the scrolls that told of all deeds. And the first scroll said “Notice”, but no one noticed. And the second scroll said “Info”, but it was not heard. And the third scroll said “Warning!”, but it was not heeded. And the fourth scroll said “Error!!”, yet no one moved. And when the final scroll was open, it just said nothing.

After a program has crashed, the only thing left to do is to look at its messages in the logs, like a black box in a plane crash. But a good logging policy can get you better than a look at the last instant of a bad program, you can gain insights and detect an ailing software before it goes down. It takes the place of the Judgement, where, as in the apocalypse, it is decided what to do with an app after an account of its lifetime.

XXI. Debugger

The mind is still, the world is still. In one glance, I view the whole. I am the program, and the stack, and the machine, and the compiler. I break the flow of execution or let it run like water. I watch the variables and the registers. I have snatched the error from the trap frame. Time for time to resume.

The final arcane of the tarot, the World, evokes the idea of having the full picture, which is exactly what a debugger lets you do, an ultimate tool that can literally stop time for a program to figure out exactly what’s going on in its execution.

NULL

Segmentation fault

Arcane 0x0’s artwork was prompted to imitate the style of famed Dutch artist M. C. Escher.

Acknowledgements

I designed (or rather, prompted the AI to draw) the cards to evoke broad aspects of programming, while trying to maintain a reference with the original divining tarot cards. I tried to avoid using a specific artist in the prompt, except in one very obvious case. The results, Midjourney’s somewhat oniric drawing and the somewhat consistent imagery that my style prompt: “comic book high contrast layered digital mystic” are fitting for the symbol-laden imagery of the tarot. The prompts for each illustrations (as well as many others that didn’t make the cut) are shown on my midjourney profile.

I was inspired by the simultaneous occurrence of the Apple ML summit, which had a deck of cards representing various areas of Machine Learning as swag, and buying a bunch of cool stickers from my local bookshop. Finally, I realize that I probably wasn’t the first to have the idea, although I only became aware of this tumblr post after most of the cards were done.

This idea was further fueled by a few classic pseudo-mystical texts about programming including the Rootless Root hacker Koans, the Tao of Programming and Alan Perlis’ Epigrams on Programming.