-3
\$\begingroup\$

This question already has an answer here:

This is a brainfuck version of Largest Number Printable, and this.


Let's think about brainfuck interpreter such that,

  1. Has array that can be stretched left & right arbitrary large
  2. Each cell can contain arbitrary large integer
    • Can contain negative integer too
  3. When the interpreter starts, every cell is intialized by 0
  4. . prints integer representation of value of cell, then LF.

For example, <<+++.>--. prints

3
-2

, then terminate.


Description

Your goal is to write a brainfuck program that prints a number/numbers. The bigger the number, the more points you'll get.

There are some rules to follow.

  • Your program must terminate.
  • You should not use ,.
  • You can print multiple integers.
  • Your score will be largest number that the program prints.
  • Maximum code length is 1024 bytes. (Only []+-><. counts)

Here is sample brainfuck interpreter that you could test.


Leaderboards

:)

\$\endgroup\$

marked as duplicate by Community Feb 15 '18 at 11:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    \$\begingroup\$ What's the point in having a separate challenge while such answers can as well be posted to the other challenge? \$\endgroup\$ – user202729 Feb 15 '18 at 9:58
  • \$\begingroup\$ @user202729 largest number printable challenge's maximum code lengths are 100, and it is quite short for brainfuck. \$\endgroup\$ – 0xrgb Feb 15 '18 at 10:06
  • \$\begingroup\$ Here's a TIO link for your brainfuck interpreter \$\endgroup\$ – Jo King Feb 15 '18 at 10:17
  • \$\begingroup\$ Is there any sort of time limit? \$\endgroup\$ – Jo King Feb 15 '18 at 10:18
  • \$\begingroup\$ @JoKing There are no time limit for program. But it must terminate. \$\endgroup\$ – 0xrgb Feb 15 '18 at 10:24
0
\$\begingroup\$

Score: 2↑↑45306

Edit: Replaced it with a more modifiable version. Try 2↑↑2, 2↑↑3, and 2↑↑4 (2↑↑5 times out)

Just testing the waters with a short answer.

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

The ↑↑ indicate Knuth's arrow notation, where a single ↑, such as X↑Y, means (((X*Y)*Y)*Y)... X times = X^Y, and two ↑↑s means (((X↑Y)↑Y)↑Y)... X times. For example, 2↑↑4 = 2222.

(I'm not familiar with bignum notation, so please tell me if there's a shorter way of representing this, or there's an error in my calculations)

Explanation:

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

Produces the number 45306. (Taken from the brainfuck constants page on Esolangs, an immensely useful page). This will be used as the counter.

>++< 

Sets the current value as two and move back to the counter

[ Loop until the counter is 0

    Square the current value
    >[->>+>+<<<]
    >>>
    [
        <[-<+<+>>]
        <[->+<]
        >>-
    ]<[-]

    Decrement the counter
    <<<-
]

A few ways to extend this:

  • Increase the counter. Pretty easy to do.
  • Increase the initial value. To be simple, you could just set the initial value and the counter as the same number
  • Remove the clear cell in the squaring operation, which compounds the result
  • Create another counter and put another loop around the whole thing
    • This effectively adds another Knuth's Arrow to the result (I think)
    • Further addition, for each iteration of the outer loop, copy the current value to use as the inner loop's counter
    • And then put another loop around the whole lot again.
\$\endgroup\$
  • 1
    \$\begingroup\$ Squaring 2 45306 times only gives you 2^2^45306. \$\endgroup\$ – lirtosiast Dec 1 '18 at 1:57
  • \$\begingroup\$ @lirtosiast Yeah, I feel kinda stupid looking back at this. I was mixing up \$((2^2)^2)^2...\$ with \$2^{2^{2^{2...}}}\$ \$\endgroup\$ – Jo King Dec 1 '18 at 2:55

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