London, 1843Weave with Lovelace

This machine can't think. It does exactly what its cards tell it, one card at a time, and nothing else.

You hang the cards. Can you make it weave the pattern, with only a few cards?

Six looms, dealt at random each game: two easy ones, then two harder, then two hard. After them, more and harder still, if you want them.

Loom 1 of 6

The order
Your chain
Cards you can hang · tap one
Same cards, other things

What do the holes mean?

This is your chain from the last loom. A card is only holes in pasteboard. The switch decides what the holes mean. Flip it to Notes or Numbers and run the same cards again.
Your chain, read as threads
What came out
The last order

Make something new

The order: weave a pattern nobody has thought of. Not one from the cards. A new one, that the machine makes up itself.
Here are all the cards there are. Is there one for that?
“make something up”: there is no such card
What came out
Lovelace's own chain

Her chain, for numbers

Lovelace wrote a chain like yours. Hers works out a famous row of numbers, one after another: the Numbers of Bernoulli. The plum card is the one the machine is reading.
these cards go round again, like one of your loops
The end
How to play

The machine

Lovelace's machine never thinks. It reads your chain of cards from the top, one card at a time, and does what each card says. When it runs out of cards, it stops.

Hanging cards

Tap a card at the bottom to hang it at the end of your chain. Tap × to take a card off. Only so many cards fit. Then tap Run the loom and watch. The dashed squares are the order; each stitch the loom weaves fills one. A wrong stitch gets a black frame.

Go back and count down

The machine counts with wheels: numbers inside it. Every wheel starts at 0. A Set card puts a number on a wheel (you choose it on the card), whatever it showed before. That is the only way a wheel gets a number.

A Go back and count down card first takes 1 off its wheel (you see −1 on the wheel), then looks at it. If the wheel isn't 0 yet, the machine goes back up the chain to the card you chose on it (“card 1”, “card 2” …); the arc on the left shows the jump. If the wheel shows 0, the machine carries on down the chain. Nothing else ever counts down: the wheel only goes down when this card is read.

Set cards

A wheel that reaches 0 stays at 0 until a Set card puts a number on it again. That is what a loop inside a loop needs: the inner wheel must be set again on every round of the outer loop, so the outer Go back and count down has to send the machine back to (or above) the inner wheel's Set card. It can jump to any card above it, a Set card included. But a simple loop should go back to its first stitch, not to its own Set card: that would put the number back every round, and the wheel would never get to 0.

Fewest cards

When the bell rings you are told the fewest cards that can do the job. On the hard looms there is no spare room at all.

After the six

After the sixth bell you can stop, or go on: two looms with two runs inside one loop (the inner wheel is set twice on every round), and then one final loom with a third wheel, a loop inside a loop inside a loop. None of them is required.

Stuck?

After any run that doesn't ring the bell, you can ask to see a way. It's one way, not the only one; your own chain stays hung until you change it, so you can keep trying as long as you like. Every loom can be tried again after the bell, and the end screen takes you back into any of them; your best go is the one that counts.

About the paper

The game in one line

A machine that does exactly what its cards say. Six looms are dealt at random from a library, two easy, two harder, two hard, with three more beyond them for those who want them: you hang as few cards as you can to weave each order, with wheels that hold numbers, Set cards that put a number on a wheel, and Go back and count down cards that take one off and look, so that on the hard looms a loop sits inside a loop. Then a switch makes the same cards play a tune and do sums, and you ask the machine to make something up. It can't.

What the paper does

In 1842 L. F. Menabrea published a sketch of Charles Babbage's Analytical Engine, a calculating machine driven by punched cards. In 1843 Ada Lovelace translated it and added seven Notes, longer than the sketch itself. The Notes are the text this game is built from.

Note A says the Engine weaves algebraical patterns just as the Jacquard-loom weaves flowers and leaves, and that it works on operations, not on any one kind of thing: it could act on anything whose relations can be written in symbols, music included. Notes C and E explain backing: the cards can be sent back so that a few of them do duty again and again, a cycle. Note F shows three cards doing the work of three hundred and thirty. Note G gives a full chain of cards for the Numbers of Bernoulli, twenty-five cards that serve however great n may be, and warns that the Engine has no pretensions whatever to originate anything. It can do whatever we know how to order it to perform.

What is the paper's, and what is ours

The loom is Lovelace's own picture from Note A, made literal: the Engine did arithmetic, it never wove cloth. The counting is done as the Notes say an Engine counts: with a number in the Store and cards that operate on it. A wheel is such a number: every wheel starts at 0, and only a card puts a number on it. The Go back and count down card is her Operation 7 in Note G joined to her backing in Note C: a subtraction whose result the Engine feels; if it is not yet zero, the cards are backed to an earlier card, and if it is zero, the Engine goes on (Menabrea's counter, too, has a unit taken off each time until it marks zero). A Set card is a card of numbers (Memoir p. 15): nothing resets a wheel by itself, so a loop inside a loop, her cycle of cycles (Note E), needs the outer loop to go back through the inner wheel's Set card on every round. In her own tables the subtraction and the decision are separate steps; here they share one card. Counting cards is her yardstick too: Notes D, F and G all count how few cards will do. The puzzles, the fewest-card counts (found by trying every possible chain) and the switch's tune and sums are ours.

The coda is hers. It runs Lovelace's own table from Note G, operation by operation, on a working model of the Engine's card language, and prints the first four Numbers of Bernoulli: 1/6, −1/30, 1/42, −1/30, with nine, fourteen and twenty-five cards. Two small repairs: one division is done the way round her text requires (the printed table has it reversed), and a sign is flipped so the Numbers print with the sign her formula gives. Her cycle (operations 13 to 23, in brown) is simply repeated for the fourth Number.

The Engine was never built. Nothing here is evidence about the machine; it is the Notes' ideas, running.

The paper

L. F. Menabrea, Sketch of the Analytical Engine invented by Charles Babbage, translated, with Notes upon the Memoir by the Translator, Ada Augusta, Countess of Lovelace. Scientific Memoirs 3 (1843): 666–731. Read it online at fourmilab.ch/babbage/sketch.html.

Fonts: Abril Fatface and Old Standard TT (SIL Open Font License).