esolang

Cyclic Clockwise Rotating Contraption

A perpetual motion machine. The program spins on a ring, and the only way to stop it is to slow it down.

raiseafloppafan7741, 2025 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: a

The idea

raiseafloppafan7741 made CCRC in 2025, when he discovered ring buffers. The program and the data each sit on a ring with its own speed and acceleration. Each tick the program head runs one command, and then both rings turn. The end of the code leads straight back to its start, so nothing ends a program by itself. It halts only when the speed of a ring falls to 0, which makes ], or { for the data ring, the way out.

The machine

The accumulator and the data cells are unsigned 32-bit numbers.

CommandDoes
i d sAdd 1, take 1 away, square, as in deadfish
I ORead or print a character; the end of input reads as 4294967295
Z eStore the accumulator in the data cell, or load it
P XAdd a cell holding the accumulator at the end of the data ring, or remove the last
[ ]Raise or lower the program ring's acceleration by 1
} {Raise or lower the data ring's acceleration by 1
( )Jump to the matching bracket if the data cell is 0, or back if it is not

Both rings start at speed 1 with acceleration 0, and the data ring has one cell of 0. After each command each speed takes on its acceleration, and each ring turns by its speed. Every other character does nothing, which helps to wait for the right cell of the data ring.

Example

The one time cat prints one character, and then ] takes the speed of the program ring from 1 to 0.
Expected: hello

The one time cat prints one character, and then ] takes the speed of the program ring from 1 to 0. Without it, IO is a cat that never stops.

The second cat stops at the end of input. There i turns 4294967295 into 0, so ( jumps past ) onto the first ]. While there is input, [ raises the speed to 2 and the head skips ) and the middle ]. The last ] and [ bring the speed back to 1 before the ring comes round to I again.

The truth machine takes 49, the code of 1, from its input. Any other input is printed once.

Expected: 0

The Hello, world! is deadfish's with O for o. At the end the loop Z(dZ) counts the accumulator down to 0, ten i make a line feed, and ] stops the ring.

Further

Ideas it shows

Cyclic Clockwise Rotating Contraption builds on Deadfish~.

Accumulator-based

Deadfish derivatives

Write your own in Run Convert a program from Cyclic Clockwise Rotating Contraption

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: cyclic-clockwise-rotating-contraption.

Command line

shib run cyclic-clockwise-rotating-contraption -e 'IO]' --input 'abc'
shib manual cyclic-clockwise-rotating-contraption

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/cyclic-clockwise-rotating-contraption.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org