16
\$\begingroup\$

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.

\$\endgroup\$
  • 3
    \$\begingroup\$ +[.] Do I win? :P \$\endgroup\$ – Quintec Feb 1 at 2:04
  • 3
    \$\begingroup\$ Perhaps it might be more interesting to score on the length of the output? \$\endgroup\$ – Jo King Feb 1 at 2:22
  • \$\begingroup\$ @JoKing That's a good idea. Unfortunately it appears to be a bit late for that. \$\endgroup\$ – Sriotchilism O'Zaic Feb 1 at 3:19
  • 2
    \$\begingroup\$ Also, why is this tagged quine? \$\endgroup\$ – Embodiment of Ignorance Feb 2 at 5:25
  • 1
    \$\begingroup\$ @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. \$\endgroup\$ – Sriotchilism O'Zaic Feb 2 at 18:44
14
\$\begingroup\$

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
\$\endgroup\$
4
\$\begingroup\$

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.

\$\endgroup\$
4
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.