Picked up Beltmatic recently and wanted to come up with a way to create any number from the same machine. I haven’t unlocked everything yet so maybe there’s something that will let me make this smaller or more efficient, but for now this is what I’ve got.

First, taking an overview of the whole machine. You could say there are 4 main parts: The adder, the selector, the Zero Machine, and the mines.

## The Adder

The adder just takes each of the bit belts and adds them together in stages. Each bit belt is going to have either a 0 or that bit’s value on it, depending on what’s chosen in the selector. (I don’t know how those -3s ended up on the 8 belt.) Multiple sets of adders are used to account for the slower speed compared to the belt. In the final version I’m going to use belt priority so the first adders fill up before any numbers can go farther down the line, but in the end that’s just a visual thing – the output ends up saturated on average if you have enough adders.

Here I’ve only got belts and adders through 12 bits (up through 2048, for numbers up to 4095) but there’s room to go to 16 bits and no reason the design can’t be expanded for larger numbers. The number being produced here (819) is the largest I’ve been asked for yet, so I imagine it will be a while before I even need to connect the 2048 line.

## The Zero Machine

This just uses subtractors to create zeroes by subtracting a number from itself. Subtractors are slow so you need a lot of them; this is probably more than I need but I want to make sure I have enough at all times. You need to feed zeroes in for unused bits, otherwise the adders will just stall if one input has a number and the other has nothing.

## The Selector

This is how you set the machine up to produce a given number: for each bit, either connect the number or the zero.

## The Mines

We look around for 4s and 8s to mine, to add or multiply together to make the powers of 2. On top there’s 8*8*8 making 512, and on the bottom there’s 8*8 being done twice to make two belts of 64s, which are then added together to make 128s.

1s, 2s, 4s, and 8s are fed in directly from appropriate nodes, and 16s are just two belts of 8s added together. Making larger numbers is going to require more belts (e.g. 1024 could be made from five 4s or three 8s + one 2) but with the limit of the number of belts you can get out of one extractor, these might be harder to set up.

The belts are fed in from the bottom of the selector, on alternating lines, while the 0 machine to the right fills in the other belts.