}0
--@2
@2/\=0MB
}0@1\/
&0/\>0!!
--
@1
00@0
--/\=0
\\@0&0
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 10^1189
years.
Further explanation of the Marbelous board
00@0
--/\=0
\\@0&0
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@1
&0/\>0!!
--
@1
}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.
}0
--@2
@2/\=0MB
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.
So why n*512
?
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 makes sure discarted marbles don't interfere with other marbles that are looping a round and prevent the program from terminating.
Bonus
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.
You should post a question with the same title on Philosophy.SE, and maybe on one of the 50 programming sites.
– Cyoce – 2016-01-14T16:18:18.797I am voting to close this as too broad because we require objective validity criteria for all challenges. As it stands, there is no clear way to determine the validity of a submission. Additionally, there is no specification of the behavior of a valid submission. – Mego – 2016-03-31T07:16:16.593
Will have a play with this a go on Turing Machine code. Meanwhile, gold badge vote. – ouflak – 2019-10-27T09:15:13.960
40I was tempted to create a [slowest-code] tag for this question. :P – Doorknob – 2014-08-24T22:08:20.740
5A Bogosort wouldn't work because while it's infinitely improbable that it would never finish, it may require an infinite amount of time to finish. There are, however many awful NFA-based regular expressions that could satisfy the "will finish, but not before the universe is dead" criteria. – DavidO – 2014-08-24T22:16:22.380
2Is this actually different from a challenge to make large numbers? – xnor – 2014-08-25T02:21:23.957
49Your title should be a tshirt – user-2147482637 – 2014-08-25T02:54:03.403
4Nice question, but shouldn't it be popularity contest ? – IazertyuiopI – 2014-08-25T06:38:31.770
just out of curiosity, how long would it take to generate a duplicate GUID ? – Thousand – 2014-08-25T08:56:19.977
3
@IazertyuiopI, no.
– Peter Taylor – 2014-08-25T13:01:21.0001
Been done :-) by John Cage and his ASAP organ piece http://en.wikipedia.org/wiki/As_Slow_as_Possible
– Carl Witthoft – 2014-08-25T13:17:17.733The in-character edit is what took this over the top for me, giving t it a +1. – trlkly – 2014-08-25T13:29:15.780
12
I think Isaac Asimov wrote a story about this.
– David Conrad – 2014-08-25T17:02:02.3172@IazertyuiopI Why? [tag:code-golf] seems like the obvious scoring metric for this. – Calvin's Hobbies – 2014-08-25T20:41:09.423
1@Calvin'sHobbies I was afraid it would encourage people to submit similar short answers (only counting to/evaluating a large number) at the expense of creativity , but since the long answers get upvoted, I guess there is nothing to worry about =P – IazertyuiopI – 2014-08-26T05:31:09.450
1Infinite memory isn't necessary. The processor can access only a finite amount of memory in the finite amount of time. 10^5030 bits sounds like a reasonable upper bound. – MSalters – 2014-08-26T14:51:17.057
@Doorknob: The tag you were looking for is [tag:busy-beaver]. I added it. – Nate Eldredge – 2014-08-27T16:00:56.417
This challenge reminded me of the minecraft 'Universe Death Clock' https://www.youtube.com/watch?v=F1CddzgVW14
– RoboKozo – 2014-08-27T22:50:37.1533Am I the only one who thought of the Ackermann function instantly when I read the description? – PsHegger – 2014-08-28T09:29:11.683
After the death of the universe no one can see you halt. – marczellm – 2014-08-28T11:33:12.613
@PsHegger me too! – shortstheory – 2014-09-01T10:05:39.887
I improved my answer to 8 chars, I'm in 4th place now. :) – Nicu Stiurca – 2014-09-03T13:33:25.760