The year is 2090. Kaizen Security has commissioned an Australian successor to the Woodpecker processor.
The engineers decided that four instructions were two too many. So they halved the instruction set.
And the name.
Unfortunately, it still needs to do multiplication. That's your problem.
The machine
Ocker has an infinite tape of bits, a head pointing to one cell, and a one-bit register called store.
Its two instructions, F (Flip) and M (Move), are composed of the original Woodpecker instructions as follows:
| Ocker | Woodpecker | Effect |
|---|---|---|
F | LOAD INV | Copy the current bit into store, then flip that bit on the tape. |
M | INC CDEC CDEC | Move the head one cell right if store is 0, or one cell left if it is 1. |
The tape extends infinitely in both directions, with integer cell indices. Initially, the head is at cell 0, store is 0, and all cells are 0 except for the inputs.
The challenge
Write the shortest possible Ocker program to perform the following operations. Integers are unsigned and stored least significant bit (LSB) first, with the LSB at the lowest address. Only the final output cells are checked; everything else may be changed. AI assistance is encouraged.
| Level | Operation | A | B | Output | Target |
|---|---|---|---|---|---|
| 0 | 1-bit addition | 0 | 1 | 2–3 | 16 |
| 1 | 16-bit addition | 0–15 | 16–31 | 32–48 | 100,000 |
| 2 | 16-bit multiplication | 0–15 | 16–31 | 32–63 | 10,000,000 |
The score is the number of instructions executed. Try to meet or beat the target for each level.
Verifier
Paste a program using F and M, optionally followed by a positive repeat count. For example, FM3F2 means FMMMFF and still counts as six instructions. Whitespace is allowed between tokens and before counts.
Your program stays in your browser. Tests are fixed and public; passing them is not a proof of correctness for every input. The verifier accepts expanded lengths up to 253 − 1.