close
Skip to content
dokutan edited this page Jul 5, 2024 · 9 revisions

Python script to generate Brainfuck that prints strings with multi-byte characters:

string = "Hi 😊"

for b in bytes(string, 'utf-8'):
 print(b)
 print("+" * b + ".>")

A shorter one for bytes that are close to each other

string = "Hi 😊"

last = 0
for b in bytes(string, 'utf-8'):
 diff = b-last
 last = b
 print("-+"[diff>0] * abs(diff) + ".")

Constants

  • Brainfuck constants is a list of the shortest programs to generate specific values.
  • If you need multiple constants, try to generate them with a single loop
  • Make use of the cell wrapping

Clone this wiki locally