Unpredictabillity
What is Unpredictabillity
Unpredictabillity by User:Esocreator is a language that relies on randomness. Its "purpose" is to make everything compact and tiny and basically be the final boss of golflangs. And also be terrible to code in.
Explanation
It works that you convert a number into base 256, then store the base 256 digits as well, ASCII characters. And then, to run it, you convert those ASCII characters to decimal, interpreting the ASCII characters as digits again, and then, we create a completely randomly generated Brainfuck program with (the number we converted to base 256 earlier) characters, with correct syntax (no unmatched [ and ] and no []), and then run it. So the Hello World program is just one byte, but theres a 1 in 2333 chance or 1 in ~1.7498 * 10100 chance it even runs the actual Hello World program. The amount of bytes in an Unpredictabillity program representing a n byte BF program is floor(1+log256(n)). No one asked, but why not? It is Turing-complete because Brainfuck is. did i bold too much text? i think i did
Hello World Program
o
Tetris (How the code looks like in the Windows-1252 format)
Ñì
Snake
Ûä
^^^ Are you a zombie?!?!?!?
Quine
o (ASCII code of o is 111, and there are alot of 111 character BF programs that print o)
Brainfuck to Unpredictabillity Converter in Python
def bf_to_unpredictabillity(filename_in, filename_out):
bf_chars = set("+-><,.[]")
with open(filename_in, "r", encoding="utf-8") as f:
bf_code = ''.join(c for c in f.read() if c in bf_chars)
n = len(bf_code)
bytes_list = []
temp = n
if temp == 0:
bytes_list = [0]
else:
while temp > 0:
bytes_list.append(temp % 256)
temp //= 256
bytes_list.reverse()
unpredictabillity_program = ''.join(chr(b) for b in bytes_list)
with open(filename_out, "wb") as f:
f.write(bytes(bytes_list))
bf_to_unpredictabillity("bf_code.b", "unpredict_code.u")
Interpreter
WIP. I am lazy