> Move the pointer to the right.
< Move the pointer to the left.
+ Increment the memory cell at the pointer.
- Decrement the memory cell at the pointer.
. Output the character signified by the cell at the pointer.
, Input a character and store it in the cell at the pointer.
[ Jump past the matching ] if the cell at the pointer is 0.
] Jump back to the matching [ if the cell at the pointer is nonzero.
I/O is not required for Turing completeness, so .
and ,
are optional: a canonical Turing machine leaves its calculated answer on the tape. However, I believe all other commands are required, so the highest codepoint the language uses, ]
, is required.
There are a number of trivially-similar languages. I'll cover these here as well, unless people feel they are genuinely worthy of separate answers. I have assumed for each language that their commands are case-sensitive unless otherwise stated.
You only need one of the two BF instructions -
and +
for Turing completeness. And if the tape/memory is limited and wraps around, then we only require one of <
and >
, too. I've updated the below lists to take these into account.
Identical to BF for our purposes:
BFFB, Score = 93 (]
) Requires code be a palindrome but uses the same characters as BF.
LolKek, Score = 93 (]
).
Pi, Score = 93 (]
).
RRF, Score = 93 (]
).
BF-, Score = 93 (]
).
.
???, Score = 59 (;
) 45 (-
) Not quite a trivial substitution, but close enough. Omitted ?
, ;
and .
as unnecessary for TC.
Alphuck!, Score = 115 (s
).
And then, Score = 122 (z
from required preamble).
Anguish, Score = 98 (U+2062
) 97 (U+2061
). Omitted U+2062
as unnecessary for TC.
Blub, Score = 117 (u
from Blub? Blub!
).
BrainFNORD, Score = 115 (s
in eris
) 112 (p
in pineal
). Omitted eris
and fnord
as unnecessary for TC.
Colonoscopy, Score = 123 (}
of }}
).
Fluffle Puff, Score = 116 (t
) 115 (s
of *gasp*
).
FuckbeEs, Score = 115 (s
).
Fuckfuck, Score = 116 (t
of b..t
).
GERMAN, Score = 85 (U
of ADDITION
or SUBTRAKTION
).
Headsecks, Score = 7 (U+07
).
Integral, Score = 120 (x
of the polynomial expressions).
LMBC, Score = 125 (}
of n\n\\n\>\<" }*/ continue;
).
Omam, Score = 46 (y
of this ship will carry
).
Oof, Score = 111 (o
of oooooof
).
Ook!, Score = 107 (k
of Ook? Ook!
).
oOo CODE, Score = 111 (o
of OOo
).
Pikalang, Score = 117 (u
from chu
).
POGAACK, Score = 112 (p
from poock?
).
PPAP++, Score = 86 (V
from I HAVE AN APPLE,
or I HAVE PINEAPPLE,
).
Revolution 9, Score = 121 (y
from if you become naked
) 118 (v
from Revolution 1
).
RISBF, Score = 47 (/
of /+
)
Roadrunner, Score = 112 (p
from MEEp
).
Ternary, Score = 50 (2
from 02
).
tinyBF, Score = 124 (|
).
Unibrain, Score = 48 (0
, needs at least 1 alphanumeric).
VerboseFuck, Score = 125 (}
of }; [... etc]
).
wepmlrio, Score = 119 (w
).
Wordfuck, Score = 32 (
space) or 33 (!
) depends if chars < 32 are considered words.
ZZZ, Score = 122 (z
from z-z
).
.
.
Binary:
Binaryfuck, Score = 255 (U+FF
) or better???
Brainfoctal, Score = 255 (U+FF
) or better???
CompressedFuck, Score = 255 (U+FF
) or better???
ShaFuck, Score = 255 (U+FF
) or better???
Triplet, Score = 255 (U+FF
) or better???
ZeroBF, Score = 255 (U+FF
) or better???
Now, arguably, the score could be 49 (1
), or 1 (U+01
), or 255 (U+FF
), or whatever. I pick 255.
These each replace the 8 BF command characters with their 3-bit binary equivalents, to give an octal number from 0 to 8. This converts the program to a binary stream of ones and zeroes, which can be represented as ASCII 1
and 0
characters, or as byte values, or as bit values, or as any base you like, hence the three possible scores.
The reason for my score of 255 for the bit-values version of binary BF programs is that ]
typically maps to 111
, so three of them in a row gives you a byte of all 1s, or 255.
It could be argued that you COULD write a Turing machine in these languages which never used three ]
commands in a row. So my score may be less generous than it need be. You can prove this, if you like! :D Until then, I'm scoring them 255.
Well, in the case of ShaFuck, it's more complicated, but still... I don't have proof that it doesn't require a 0xFF byte somewhere, so I'm giving it a score of 255 until proven otherwise.
Golunar, Score = 59 (9
) or better???
So this is an interesting one. It takes a Unary program (well, any of the above "single character" solutions, and converts it to a decimal string.
In this way it is much like the other "binary" options, except it's explicitly stated to be a decimal number, one presumes in ascii.
That means that, if it could be proven that any program (or at least a Turing machine program) could be written in Unary that had a length that was describable without any 9s, the score would be able to drop, perhaps even as low as 49 (1
).
Replacement by sequences of a single character:
A, Score = 65 (A
).
Ecstatic, Score = 33 (!
).
Ellipsis, Score = 46 (.
) or 38 (U+2026
ellipsis).
Lenguage, Score = 0 (U+00
).
MGIFOS, Score = 42 (*
).
Unary, Score = 48 (0
) or 0 (U+00
).
These are really just the binary options above, taken as a number that describes the length of a string made by repeating a single character.
Other weird stuff:
BF-RLE, Score = 93 (]
) to 247 (U+F7BFBFBF).
Run-length encoded BF. There are various methods. Base-10 prefix or suffix methods, or indeed any standard base up to 36 gets the same score as regular BF (because ]
is above the uppercase range). Base 37 then typically uses the lowercase range, for a score of 97, and each additional base up to base 62 gets one worse. Bases above 62 need additional non-alphanumeric characters, but these can be selected from those below the lowercase range until those run out at base 114 (assuming 8 characters remain reserved for the BF code itself), and they then get worse by one for each base increase to base-128. After that point, UTF-8 can be used to slow the rise of the limit so that it never hits 255 for any base within the limit for UTF-8's ability to represent (some 4 million).
I dunno:
These use extended characters I can't be arsed to look up.
eval
(v
),exec
(x
),{}
, and any other constructs using high bytes. \$\endgroup\$(
will be hard to avoid for most mainstream languages, but I wouldn't mind if you (or someone else) posted it. \$\endgroup\$