Created
July 8, 2022 06:27
-
-
Save martian17/b69c1daf72ad6350cd184acf62c141b3 to your computer and use it in GitHub Desktop.
number decoding to ascii brainfuck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# input format | |
# 0 n 0 0 0 etc | |
# ^ | |
# simulating input 124 | |
>++++++++++++++++++++++++++++++ | |
++++++++++++++++++++++++++++++ | |
++++++++++++++++++++++++++++++ | |
++++++++++++++++++++++++++++++++++ | |
>>>+<<< | |
# 0 124 0 0 1 | |
# ^ | |
# first loop: 100th place | |
[ | |
>++++++++++++++++++++++++++++++++++++++++ | |
++++++++++++++++++++++++++++++++++++++++ | |
++++++++++++++++++++ | |
# 0 124 100 0 1 | |
# ^ | |
[<[->-<<]>>] | |
# 0 25 0 0 1 can be equal | |
# ^ | |
#or | |
# 0 0 75 0 1 | |
# ^ | |
>[- | |
#the termination case | |
<<------------------------------ | |
------------------------------ | |
---------------------------------------- | |
# 0 0 ―25 0 0 n | |
# ^ | |
>>>[-<<<<<+>>>>>]<< | |
# n 0 ―25 0 0 0 | |
# ^ | |
] | |
>[ | |
#the continuation case | |
>+< <<<< | |
] | |
> | |
] | |
>>>[->[-<<<<<+>>>>>]>>>] | |
<<<<<< | |
# adding 48 offset | |
<<++++++++++++++++++++++++++++++++++++++++ | |
++++++++>> | |
# second loop: 10th place | |
# the code is the same as 100th place; but the input is inverted; so some signs had to be inverted | |
>>>+<<< | |
# 0 ―24 0 0 1 | |
# ^ | |
[ | |
>---------- | |
# 0 ―24 ―10 0 1 | |
# ^ | |
[<[+>+<<]>>] | |
# 0 ―4 0 0 1 can be equal | |
# ^ | |
#or | |
# 0 0 ―6 0 1 | |
# ^ | |
>[- | |
#the termination case | |
<<++++++++++ | |
# 0 0 4 0 0 n | |
# ^ | |
>>>[-<<<<<+>>>>>]<< | |
# n 0 ―25 0 0 0 | |
# ^ | |
] | |
>[ | |
#the continuation case | |
>+< <<<< | |
] | |
> | |
] | |
>>>[->[-<<<<<+>>>>>]>>>] | |
<<<<<<[-<+>] | |
#adding 48 | |
<++++++++++++++++++++++++++++++++++++++++ | |
++++++++ | |
<++++++++++++++++++++++++++++++++++++++++ | |
++++++++ | |
< | |
# output | |
# 49 50 52 0 0 0 0 0 0 | |
# ^ | |
.>.>.<< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment