Marbelous is an 8 bit language with values only represented by marbles in a Rube Goldberg-like machine, so this wasn't very easy.
This approach is roughly equivalent to the following pseudo-code:
function recursiveFunction(int i)
for(int j = i*512; j > 0; j--)
recursiveFunction(i - 1);
since the maximum value is 256, (represented by 0 in the Marbleous program, which is handled differently in different places) recursiveFunction(1) will get called a total of
256!*512^256 which equals about
10^1200, easily enough to outlive the universe.
Marbelous doesn't have a very fast interpreter, it seems like it can run about
10^11 calls of this function per year, which means we're looking at a runtime of
Further explanation of the Marbelous board
00 is a language literal (or a marble), represented in hexadecimal (so 0). This marble falls down onto the
--, which decrements any marble by 1 (00 wraps around and turns into FF or 255 in decimal). The Marble with now the value FF falls down onto the
\\ which shoves it one column to the right, onto the lower
@0. This is a portal and teleports the marble to the other
@0 device. There, the marble lands on the
/\ device, which is a duplicator, it puts one copy of the marble on the
-- to its left (this marble will keep looping between the portals and get decremented on every loop) and one on the
=0 to its right.
=0 compares the marble to the value zero and lets teh marble fall trough if it's equal and pushes it to the right if not. If the marble has teh value 0, it lands on
&0, a synchonizer, which I will explain further, later.
All in all, this just starts with a 0 value marble in a loop and decrements it until it reaches 0 again, it then puts this 0 value marble in a synchronizer and keeps looping at the same time.
}0 is an input device, initially the nth (base 0) command line input when calling the program gets placed in every
}n device. So if you call this program with command line input 2, a 02 value marble will replace this
}0. This marble then falls down into the
&0 device, another synchronizer,
&n synchronizers hold marbles until all other corresponding
&n's are filed as well. The marble then gets decremented, teleported and duplicated much like in the previously explained loop. The right copy then get checked for inequality with zero (
>0) if it's not 0, it falls through. If it is 0, it gets pushed to the right and lands on
!!, which terminates the board.
Okay, so far we have a loop that continuously counts down from 255 to 0 and lets another, similar loop (fed by the command line input) run once every time it hits 0. When this second loop has run n times (maximum being 256) the program terminates. So that's a maximum of 65536 runs of the loop. Not nearly enough to outlive the universe.
This should start looking familiar, the input gets decremented once, then this value loops around and get copied (note that the marble only gets decremented once, not on every run of the loop). It then gets checked for equality to 0 and if it's not zero lands on
MB. This is a function in Marbelous, every file can contain several boards and each board is a function, every function has to be named by preceding the grid by
:[name]. Every function except for the first function in the file, which has a standard name: MB. So this loop continuously calls the main board again with a value of
n - 1 where n is teh value with which this instance of teh function was called.
Well, the first loop runs in 4 ticks (and 256 times) and the second loop runs n times before the board terminates. This means the board runs for about
n*4*256 ticks. The last loop (which does the recursive function calling) is compacter and runs in 2 ticks, which means it manages to call the function
n*4*256/2 = n*512 times.
What are the symbols you didn't mention?
\/ is a trash bin, which removes marbles from the board, this make sure discarted marbles don't interfere with other marbles that are looping a round and prevent the program from terminating.
Since marbles that fall off the bottom of a marbelous board get output to STDOUT, this program prints a plethora of ASCII characters while it runs.