Audiobook Cartoons & Code
Chapter 1: "Revenge of the SpaghettiOs"
Figure 1
| HTML | |
|---|---|
Chapter 3: "PyLadies and Code Freaks"
Fig. 1
| Python | |
|---|---|
Fig. 2
Fig. 3
the "function call":
| Python | |
|---|---|
our output:
| Python | |
|---|---|
Chapter 5: "The Real Moriarty"
Boolean algebra symbols
(a) ones and zeroes, to indicate true and false or everything and nothing;
(b) the basic operators and, or, not;
(c) "variables" to which "values" could be assigned (e.g., x = country singers named "Wayne")
The Weird Sisters function
Like most symbolic languages, Boolean algebra looks (and pretty much is) intimidating at first, but the specifics of the symbols are not important here: what matters is the logic of how the world gets represented and how these representations can be operated on. Say a trio of witches hope to tempt a future king of Scotland to his doom. No problem. Witches have a potion for that, and a recipe for the potion. But what if even Lidl doesn’t have all the ingredients? We might represent the resulting compromise thus:
x = standard ingredients for the Weird Sisters’ potion;
y = blind worm’s sting;
z = owlet’s wing;
then
x—(y + z) = the potion, minus blind worm’s sting and owlet’s wing
The Sisters know this compromised potion won’t work, so they try Whole Foods, where they thrill to see blind worm’s sting and owlet’s wing on sale—it’s Black Friday—but find eye of newt and toe of frog too overpriced to stomach. As such, we might reassign the variables like so:
z = toe of frog
In which case:
x—(y + z) = the potion, minus eye of newt and toe of frog.
Happily, this will work. Macbeth is doomed by his own ambition, which the civic-minded witches have merely tweaked, perhaps sparing Scotland a long and brutal Macbeth dynasty. The point is that we were able to reassign the variables without changing the validity of the output: this formula (or function) is universal. Note again that we are interested only in logical truth; whether a statement is empirically true in the external world is of no concern to a logician or a computer.
Chapter 7: "Theories of Memory"
Fig. 01
the binary number "01" given in toast

Fig. 10
the number of holes in Blackburn, Lancashire

Fig. 11
the decimal number "42" in binary form . . . 32+8+2=42

Fig.100
"42" expressed in binary form through the medium of toast

Fig. 101
the binary number 00101010 (42 decimal) stored by means of Elvis impersonators
Fig. 110
computer built with tiny coders as memory latches

Boolean algebra symbols reminder
(a) ones and zeroes, to indicate true and false or everything and nothing;
(b) the basic operators and, or, not;
(c) "variables" to which "values" could be assigned (e.g., x = dogs named "Kevin")
Fig. 111
circuit diagram for an AND gate

Fig.1000
An AND gate truth table. Only if both inputs are positive/true - also understood as a 1 in computing - is a positive/true output produced.

Fig. 1001
circuit diagram for an OR gate

Fig. 1011
An OR gate truth table. If either input is positive/true then the output will be positive/true. Only if both are negative/false - equating to a zero in computing - will a false/negative output be produced.

Logic Gate Symbols

Chapter 9: "Catch 32"
zombies list
| Python | |
|---|---|
animate zombies function
| Python | |
|---|---|
Apollo 11 'Burn Baby Burn'
ending—deliriously—with the assembly language source code for the Apollo 11 lunar module: This was posted to GitHub as recently as 2016. Apollo fans may further enjoy the ABC News piece, "Apollo 11's Source Code Has Tons of Easter Eggs, Including an Ignition File Titled 'Burn Baby Burn: There are jokes, Shakespeare quotes and a reference to the Black Power movement."
Even an untrained eye can recognize the caution baked into Burn Baby Burn, the program designed to ignite the lunar lander rocket and shoot Armstrong and Aldrin back into space from the surface of the moon, from the number of Boolean "flags" used to confirm the program's correct running at critical points. To give a sense of what this looks like, here's a portion of the Assembly-like code for Burn Baby Burn:
Chapter 11: "The Gun on the Mantelpiece"
Shakespearian Insult Engine program
Code looks so much better in its natural habitat, color-coded and onscreen. Here are the three versions of the Shakespearian Insult Engine in this much happier environment, from least to most sophisticated. Anyone fancying a project could translate this into "PyScript", which (like JavaScript) can run in a web browser—a big deal in the coding world. PyScript, incidentally, is the project Nicholas Tollervey now works on at Anaconda. A pleasing symmetry.
Fig. 1
| Python | |
|---|---|
Fig. 2
Insult Engine v1
Fig. 3
sample program output 1
| Python | |
|---|---|
Fig. 4
Insult Engine v2 with f-string
sample output 2
| Python | |
|---|---|
Fig. 5
finished Shakespearian Insult Engine program
sample output 3
| Python | |
|---|---|
sample exit message
| Python | |
|---|---|
full list of Shakespearian insults
Want to have a go at making your own Insult Engine? Download the Mu editor (my suggestion because it's free and so immediate and easy to use, but there are plenty of free alternatives) and run the Insult Engine at your leisure. If you're feeling adventurous, substitute the six-word lists of adjectives and nouns above with the full 40-word lists given below. Props to the British Library for collating these.
Fig. 6
an empty list for potato salad ingredients
| Python | |
|---|---|
Chapter 15: "A Codemy of Errors"
Fig.1
Sonic Pi Blue Monday bass intro code
| Ruby | |
|---|---|
Fig.2
Sonic Pi zip function
| Ruby | |
|---|---|
Fig. 3
zipped Peter Hook bassline
Supercollider error message
FoxDot quark error
| C | |
|---|---|
Chapter 17: "Apologies to Richard Feynman"
Jsonerator function def
| Python | |
|---|---|
with type annotation (ugh!)
| Python | |
|---|---|