Page 2 of 2

Posted: Wed Jul 27, 2016 6:46 pm
by Hippo
BTW: What character is on position 06 of the mentioned code?
Is it's ascii 31? OK, it must be ... I like the idea <>+- are almost the same command with parameters (-1,0),(1,0),(0,1),(0,-1) ... (computed from opcodes rather than tabulated). I must say I am a bit confused by the PC going the central path in both directions ... I really cannot imagine how you could invent it. I have not studied the memory layout thoroughly ... of course I know the 00-0X is the simulated brainfuck code (with ! or \0 at the end) and (10-) are brainfuck registers. As the PC and MP are on stack, you must do rather uneffective 3v3v3v and 2v2v sequences.
I don't know if the only problem is the cycle limit.

Posted: Tue Aug 16, 2016 9:34 am
by Hippo
Wow congrats a.goth, you are definitely the brainfuck king :). (Both small and fast solutions).
BTW: what is roughly the size of the fast one?

Code size

Posted: Tue Aug 16, 2016 6:51 pm
by a.goth
Thanks for the congratulations!

My solution to challenge 'Super Fast Brainfuck' has code size 1885, but the SuperHack program consists of only 447 instructions. Furthermore, I still see room for improvement.

Nested loops

Posted: Tue Jun 13, 2017 10:25 am
by a.goth
Hippo wrote:Oh OK simple is relative :). Your compiller cycle solution was hard to extend to nested loops, my original layout works for arbitrary level of nesting (level 4 is max, but starting on line 9 would allow levels upto 9).
I think I may have found a simpler way to compile nested loops:

Code: Select all

                  [/?x         [/?x                \s0        \s0
%00  }1+}1+}1+  x?s\    }1+  x?s\    1-{1+1+1+}  x?/    {{  x?/    }xp  !
                 1s\          1s\                x1:?       x1:?
It is the compilation of the following Brainfuck program:

Code: Select all

>+>+>+[>+[-<+++>]<<]>.
What do you think about it?

Single-line loops

Posted: Mon Jun 19, 2017 3:58 pm
by a.goth
Hippo wrote:One liner for general while cycle is impossible. Oneliners are possible for cycles of known maximal number of repetitions. ... oh there is 300 brainfuck rounds limit ... so may be ...
I have been thinking about it, but even with this restriction single-line loops are not possible. However, I have found a way to compile even nested loops in just two lines:

Code: Select all

...  s/x?@s\x?s\  ...  s/x?@s\x?s\  ...   $/   ...   $/   ...
     s\ss1s/  s\       s\ss1s/  s\       x1:?       x1:?
Is it possible to simplify this further?

Re: Single-line loops

Posted: Sun Jan 28, 2018 11:10 am
by Hippo
a.goth wrote:

Code: Select all

...  s/x?@s\x?s\  ...  s/x?@s\x?s\  ...   $/   ...   $/   ...
     s\ss1s/  s\       s\ss1s/  s\       x1:?       x1:?
Is it possible to simplify this further?
I must say I like it :) it simplifies the compiler as it does not need threads to fill empty space.
And it even saves time as it skips walks back in cycles.

Thanks to $' it would be even possible to incorporate computed speedups on the fly.

([->++++<] compilation which adds to > 4 times . and clears . and so)

I just don't think theses speedups would be interesting in cases with at most 300 brainfuck cycles.