20
2
All those busy beavers made quite a mess. They wrote all over the tape. At this rate, our neighbour will stop lending us unbounded tapes.
We need a new way to play the busy beaver game, one that doesn't ruin every tape we use.
The Rules
Brainfuck only. Memory tape is unbounded both ways. Input instruction will always read \$0\$, so it can be used to clear a value.
50 bytes source limit.
At the end of execution, memory must be all \$0\$s.
Score is distance between the memory pointer's starting location and final location - if it takes \$n\$ move instructions to go between them, your score is \$n\$. Higher is better. Provide an exact value if you can, otherwise provide an estimate.
Example
32 bytes, \$2^{255}-1\$
-[-[[>]+>+[<]>-[[>]<+<+[<]>-]]>]
Explanation
- Initialize the list to [255].
[ ] Repeat as long as the list is not empty.
[- ] Decrement the left end. We need to shrink the numbers so it ends eventually.
[ [ ] ] Skip if 0 already.
[ [[>] ] ] Move to the cell past the right end.
[ [ + ] ] Make this cell 1.
[ [ > ] ] Go right again.
[ [ + ] ] Make this cell 1. We've now appended [1, 1].
[ [ [<]> ] ] Go back to the first nonzero cell on the left.
[ [ - ] ] And decrement it.
[ [ [ ]] ] We will need to transfer the rest of the number from the left to the right, so keep looping.
[ [ [[>]< ]] ] Go to the last nonzero cell on the right.
[ [ [ +<+ ]] ] Increment this and the one on the left. These are the cells we appended earlier. We transfer to them.
[ [ [ [<]> ]] ] Go back to the first nonzero cell on the left, which we are transferring from.
[ [ [ -]] ] Decrement here on the left to balance out the incrementing on the right.
[ >] We end the iteration on a now empty cell. Move right, the new left end is there.
We begin with the list \$[255]\$. At each iteration, we consume the value \$n\$ on the left of the list, and if \$n>1\$, we append \$[n-1, n-1]\$ to the right. The numbers appended \$(n-1)\$ are lower than the original \$(n)\$, so they will get smaller until they are \$1\$, at which point they are consumed without expanding. Thus, the process ends eventually, with all \$0\$s in memory. However, at each step, the number of copies of the number doubles. The score of this program initialized with the list \$[n]\$ is \$2^n-1\$.
This example is meant to show some of the techniques used in creating a submission. It's not competitive for its size.
Is there any reason for the "50 bytes source limit."? It seems arbitrary – Okx – 2018-09-09T19:53:46.363
@Okx do you have an alternative scoring suggestion? Removing the byte limit would seem to lead to unbounded length code in order to be competitive... – trichoplax – 2018-09-09T19:58:26.707
@trichoplax oh, I might not have read the challenge correctly, sorry. – Okx – 2018-09-09T19:58:55.670
3@Okx no problem - that wasn't intended as a criticism. If there's another way to score this that allows arbitrary code length, now is the time to find it before answers come in. I'm going to retag this as currently the code golf tag is misleading – trichoplax – 2018-09-09T20:01:22.480
3There has to be some limit, since more bytes lets you define a faster growing function. There's no reason in particular for 50, it looks high enough for some decent growth (definitely better than my example's exponential) and creative solutions but still too small for Beklemishev's worm or other extremely fast growth. // Thanks for fixing my tags by the way, I rushed a bit getting this out. – EPICI – 2018-09-09T20:02:01.533
2
Just for background: We try to avoid minimum scores for code golf, but this challenge is not code golf, and the number of bytes is not the score, so I see absolutely no problem with there being a 50 byte limit in this case.
– trichoplax – 2018-09-09T20:06:29.9331
Info: I think I can "trivially port" this answer from other challenge and get similar score.
– user202729 – 2018-09-10T02:01:31.913I tried to port my answer from Largest number printable, but I can only get it down to 62 bytes :(
– Jo King – 2018-09-10T03:36:18.437Sure, you can adapt a regular busy beaver. But you will lose some efficiency that way, it's like two separate programs, one that makes a mess and another that cleans it up. The score number may be similar but it'll be less competitive here. You can get more efficiency and a better score if you design something that cleans up after itself. – EPICI – 2018-09-10T03:37:00.037
Note that the number of "states" is very limited, only 50. So it would be beneficial to keep some data on the tape itself, then clear it later. – user202729 – 2018-09-10T05:47:58.487
1@EPICI My previous busy beaver was already traceless, which is why I was trying to adapt it. – Jo King – 2018-09-10T09:34:44.123