Countable
Jump to navigation
Jump to search
Countable is a possible Turing tarpit (see talk page) based on Iterate's accumulative model.
Memory
Countable consists of a set of accumulators, which can be created, incremented, and read from, with no additional interactions. All accumulators can store a single positive integer from 0 to infinity.
Commands
n and x refer to a numeric value, which can be a positive integer or infinity. Preceding a number with a (such as a1) returns the value of the referenced accumulator, and may be prefixed multiple times to continuously refer to new accumulators (such as aa1 returning the value of the accumulator which the value of accumulator 1 points to).
| Command | Action |
|---|---|
x+n |
Increment accumulator x by n. n must be a positive integer, and may be omitted if it is equal to 1. |
x*n< ... > |
Repeat the inner contents n times, with an optional label x. Multiple loops may share a label, and the label may be dynamic. |
x& |
Jump to the end of label x if you are inside it, skipping to the next iteration of the loop. |
x@ |
(Optional) Read a byte, storing it in accumulator x. |
%n |
(Optional) Output n modulo 256 as a byte. |
Examples
Cat
1+2 // This will be used to track the current accumulator.
1*1< // Outer loop to act as a breaking mechanism
2*∞< // Actual read-write loop
a1@ // Store input into the current accumulator
*aa1< // If that input isn't zero...
%aa1 // Print it
1+1 // Update the pointer to point to the next empty accumulator
2& // Skip the break
>
1& // If the input is zero, break
>
>
Decrement
1+VALUE // Where VALUE is any numeric value
1*a2< // Increment a2 to equal a1 minus one
*a3< // Doesn't run on the first step, since a3 == 0 then
2+1 // Increment a2
1& // Skip more increments of a3
>
3+1 // Set a3 to 1
>
Subtraction
5+VALUE1 // Value 1
1+VALUE2 // Value 2
2+5 // Value tracker
3+6 // Flag tracker
4+7 // Result tracker
*a1< // Decrement loop
1*aa2<
*aa3<
a4+1
1&
>
a3+1
>
2+2
3+2
4+2
>
/*
initial
flag
result -> initial
flag
result -> initial
flag
result -> ...
*/