Make a longer lenguage program

16

1

Lenguage is a brainfuck dialect that is notorious for breaking source restriction challenges. That is because Lenguage cares only about the length of it's source and not the contents.

First, the length of the program is calculated. Then, said length is converted to binary and left-padded by zeroes to a multiple of 3. The resulting binary string is split into chunks of 3 bits each of which is translated into a brainfuck command as such:

000 -> +
001 -> -
010 -> >
011 -> <
100 -> .
101 -> ,
110 -> [
111 -> ]

Finally the program is run as brainfuck1.

From here the challenge is pretty simple, write a lenguage program that takes no input and produces an output consisting of one byte repeated integer \$n\$ times, where \$n\$ is strictly greater than the length of your program.

Answers will be scored in bytes with fewer bytes being better.

Here's a hacky program to calculate lenguage from brainfuck


1: For this challenge we will use wrapping cells and a non-wrapping tape.

Post Rock Garf Hunter

Posted 2019-02-01T00:17:22.307

Reputation: 55 382

3+[.] Do I win? :P – Quintec – 2019-02-01T02:04:40.890

3Perhaps it might be more interesting to score on the length of the output? – Jo King – 2019-02-01T02:22:56.710

@JoKing That's a good idea. Unfortunately it appears to be a bit late for that. – Post Rock Garf Hunter – 2019-02-01T03:19:41.497

@Quintec Well, programs can''t have a leading + so no – Jo King – 2019-02-01T06:55:10.640

For future reference, just because nobody has posted a solution to your challenge yet (or, in this case, only 1 person has) doesn't mean that there aren't people working on solutions that could be affected by a major change to a challenge's rules/spec. – Shaggy – 2019-02-01T21:45:05.307

@Jo King We can still do .+[.] – Embodiment of Ignorance – 2019-02-02T05:24:41.740

2Also, why is this tagged quine? – Embodiment of Ignorance – 2019-02-02T05:25:04.940

@EmbodimentofIgnorance produces an output consisting of **one byte** repeated n times though something like >+[.] works. I assume that the output has to be finite – Jo King – 2019-02-02T06:08:21.677

@TRITICIMAGVS I would add the following to the sentence "where $n$ is strictly greater than the length of your program": ", and where the output is finite.", as to prevent infinite loops printing characters. – Kevin Cruijssen – 2019-02-02T16:14:53.390

@KevinCruijssen I've gone ahead and said that $n$ is an integer. – Post Rock Garf Hunter – 2019-02-02T16:39:53.247

If I understand your description correctly, Lenguage is translated into Brainfuck such that a longer L. program translates into a longer B. program and a shorter L. program translates into a shorter B. program. This is code golf. So why ask for L. programs rather than simply for B. programs with output of length at least 2^(3n)? – msh210 – 2019-02-02T18:36:14.587

1@msh210 That'll do the trick most of the time, but there are a few differences, for example different Brainfuck characters cost different amounts (+ is the cheapest and ] the most expensive) and of course it matters where in the program they are. While $2^{3n}$ is a good estimate it is not exactly equivalent. – Post Rock Garf Hunter – 2019-02-02T18:44:44.997

@EmbodimentofIgnorance Indeed, changed it to self-referential, which was split off from quine for exactly this sort of thing. – Ørjan Johansen – 2019-02-07T15:51:07.283

Answers

15

8437495638205698686671 bytes

This translates to the brainfuck program:

-[>>[>]+[->[>]+.[<]+<]<-]

Which prints exactly \$231584178474632390847141970017375815706539969331281128078915168015826259279614\$ SOH bytes.

This is calculated by the function

f(n)=2*f(n-1)+n
f(0)=0

with an input of 255.

Explanation:

-[         Loop 255 times
  >>[>]    Move to the end of a series of positive cells (initially empty)
  +        Add one cell to the end
  [-       Loop over each cell 
    >[>]+  Add one cell to the end
    .      Print a SOH byte
    [<]+   Restore current cell
  <]       Move to next cell
<-]        Decrement counter

Jo King

Posted 2019-02-01T00:17:22.307

Reputation: 38 234

4

9093903938998324939360576240306155985031832511491088836321985855167849863863065731015823 bytes

>>>>>>-[[->>>+<<<]------>>>-]<<<[<<<]+[+[>>>]<<<->+[<[+>-]>[-<<<<->+>>------>>]<<<<]>>-[<<<].>>>-]

Which prints exactly

298333629248008269731638612618517353495058861384016275770860733328251135402804732197446995616017112134460464130233444058136509123809012106419446593183683387659250431692751255099808162970657410517657862174602556590616568690423540284801267472920128909691902547970614008613488242333460665145840144517097342073878746293059960326132795671583153307437896728515625000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

(\$250^{255}\$) NUL bytes.

Credit goes to @hvd in this Brainfuck answer, so make sure to upvote him!

Explanation:

I was going to write an explanation of my own, but realized @hvd's explanation is already on point, so I'll quote it here instead:

>>>>>> is needed to leave a bit of working space.

- produces 255 (since 0 - 1 = 255 when we have wrapping cells).

[[->>>+<<<]------>>>-] turns this into 255 copies of the value 250, giving a tape that looks like:

0 0 0 0 0 0 250 0 0 250 0 0 ... 250 0 0 [0]

<<<[<<<]+ moves the data pointer back and finishes up the initial data:

0 0 0 [1] 0 0 250 0 0 250 0 0 ...

Then comes the loop: [+...-] initially sets the 1 to a 2, which gets set back to 1 at the end of the loop. The loop terminates when the loop body already set 2 to 1.

Now, the numbers 2 250 250 250 ... 250 represent a counter, in base 250, with each number one greater than the digit it represents.

  • [>>>]<<< moves all the way to the right. Since each digit is represented by a non-zero number, this is trivial.

  • ->+[<[+>-]>[-<<<<->+>>------>>]<<<<]>>- decreases the counter by 1. Starting with the last digit: the digit gets decremented. If it remains positive, we're done. If it turns to zero, set it to 250, and continue with the digit before.

  • [<<<].>>> moves the pointer back before the left-most digit, and this is a nice moment to print a NUL byte. Then re-position to exactly the left-most digit, to see if we're done.

To verify correctness, change the initial - to + to print 2501 NUL bytes, ++ for 2502, etc.

Kevin Cruijssen

Posted 2019-02-01T00:17:22.307

Reputation: 67 575

4

19326644346528796447 bytes

Brainfuck code:

>+[+[[+>->-<<]->>+].<]

Prints

57896044618658097711785492504343953926634992332820282019728792003956564819967

null bytes.

It works like this:

mem[i]=255;
do
    while(--mem[i]){
        mem[i+1]=mem[i+2]=mem[i];
        mem[i]=1;
        i+=2;
    }
while(mem[--i]);

Quite straightforward recursion.

jimmy23013

Posted 2019-02-01T00:17:22.307

Reputation: 34 042