However, there are many minor variations on the exact methodology. Generally this is only useful for the cell editing commands
Base 10, prefix
This is probably the most obvious as it uses decimal numbers and reads in the normal English order "Twelve plusses". The decimal numbers are used to prefix the standard brainfuck commands, so the sequence
++++++++++++ is encoded as
This gives a trivial "Hello World!" as below.
Base 10, suffix
Instead of prefixing the command it's also reasonable to make the instruction count a suffix to the relevant command character. The sequence
++++++++++++ would be encoded as
+12. This variant is used in the Nairb derivative along with the
: for decimal printing.
While, initially, this may seem less closely related to the English description, it is sometimes considered more reminiscent of mathematical nomenclature. This may be more obvious if a
* symbol is included to explicitly describe the multiplication concept as in BF_Joust.
Any base can be used, a base 62 numbering system with the digits going from
0-9, A-Z, a-z achieves the highest reasonable density with plain ASCII. However, base36 or below can use case-insensitive letters.
Standard base64 uses
+ as a digit, so only non-standard variations (eg using
_) are usable.
The compression system BFC uses hexadecimal prefix style and the character
_ as a replacement for
Base two allows an interesting variation. This example has
= mapping to
[-], another rather obvious construction. But the first character printed would usually be something like
[-]1001000+., in this case rather than using two digits the binary number has been transformed to
* character is a zero while the command character is used as a one.
Using a count of zero, one or two is obviously not useful, as it doesn't shrink the size of the code. This means a minor optimisation might be to assume that a count of zero actually means that the command character is repeated three times, with all the other counts shifted appropriately. This reduces the final size a little more.
Brainfuck to BF-RLE
When converting to these encodings non-command characters have to be stripped before conversion. It is reasonable that the generated number should be directly beside the command character (no line breaks between them), but otherwise it is reasonable to include line-breaks so the lines don't get too long and perhaps other whitespace.