Looking for programs in a huge Boggle board

25

4

Each character in this 64 by 64 block of text has been chosen randomly and uniformly from the 95 printable ASCII characters.

/rq$:Zy5*g'$DeGXX2o8y "{@Cg:FR9qih}xh >5$DsF1Fs5Ao~smFp;.RJbV )U
c4\(|Sx*V$10G9xO:NjHKasem%,\9[pPm@&kTaN~HC[;9`lgqlAH(7dt0a-5}LJ[
&sifw9V-.PLRoD~F'dJYA^Q)L#h>$9h!B4b&ceKp8~HndzDm#1/ySydrf5T8[Y%4
U9>HLQ74Qf[^V9tpWrKFcFxZJ::4?z/o]3u,V[B&hB9lFYA0:rW#yql5z9.d*D}U
:M2*O9'7_HMGw_=%@hR>O+(@Dr6MIt(=/{-{4lia0Vmws32wr(fnTmT%HSo&7!uz
\KZWG&KnXh+6E+Q>%pV(<Bnm-d+p~y~]Ta"aw9)]0A_AHz\tP3&}1R^/yPPSgN?8
".7|Uj)S7-k[`yeLO~P2a?z3wiS(R-\k'?z(pVm;;D^k/q84?&7:,E*9$UQ"UbBJ
ME]&*R ,*7PDF4Tw*-;De{YeP_al.CJcJX`@V_y+>^<h{L[^Y"!RxjN^lyA_/Y=(
#C>Zo#Sl;UUD5ChIj'L@rkELk%S*]a$87j\\n;}796m/\NPL>8d-T-hR!7ftw ?A
tV5"E309bAv$jhE6\'8f?VGlBb?z#V;F((3'|}$tfpiNB>"*mxc,X1s:/%x*JQAL
rxYXUJsd?X}^yc|'16539vd=psU'>|y/!$-TRamKcJk^2-aD35h7CcaRNue"8#{;
@yUq?*(72I8@I)So+]RwtKy:mLhjG/f#:U<TXml<PtX*+,ngfZt75-q*gSsyI2tS
|*M*;yz6u2(LZ>W`bth-7G~>|dh'pm}]@"#Oq9%o\W)b,gh%b1O]4F:EGb7ERI=@
ehMo69slKw=S@<j*Q4sfd\1')#)V&yaPF%%ZG6VK\_-$Cab,nrlW"O(<tu&xU=I&
|[g4k2L;FD)=yX0SsE-|vI(mDOccuU(+m\wxgrJxi8ZP[uD)L.!K@]%@q`!pk8Yx
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9g An{=Rj|y&A2Vh^F\3lb#N~8w0EMx<K$]z(eZS~zbmgeeV\i7,MY~zrc+;

Your task in this challenge is not to write your own code, but rather to extract code from this block of text as if it is a huge Boggle grid and you're looking for a runnable program instead of a word.

The submission with the program that produces the longest finite output wins.

Details

Treat the 64 by 64 grid of text exactly like a 64 by 64 Boggle grid with additional characters. Construct a string that is a runnable program in some language by choosing a starting location in the grid and repeatedly moving one step vertically, horizontally, or diagonally (8 directions total) as many times as you want. You may NOT use the same grid space more than once!

For example, these 4 lines were taken from near the middle of the text block:

EJzH \gwosC>Z*)H!]1BPaIEYGyk{c0zv{d\#px2@#'-T{{.Qxknxv}"x3#K]w>;
<X(\bNnY_6*7Yu7_3a+wInwt vh=1eBgz>7Bnhs!<t.T#&V{+?p+{.RTN:xz>|,E
$upN*[F4A`~ZDMDt{.&2z+LZ7bcfeJfF9Uy3xX]ZzQ1FvB.U4S!hm$LYCp: wF7h
 47-+lY$"}AExXQ@?!/6}biptH=6N-6&8-T\C8{`i56e'%cimv,0QKYTx) "nkFJ

Starting with the p near the right end of the third line I can move to the by going diagonally down and right, then to the " by going right, then up 3 times over  zK, and left 4 times over #3x". This traces out the string p " zK#3x" which when run as a Ruby program outputs " zK#3x".

The goal is to find a program that produces the longest finite output. Only printable ASCII characters are considered when counting the length of the output (this means tabs and newlines are not counted), though other characters may be present. The Ruby example only produces 8 characters.

Also...

  • The program may be from 1 to 4096 characters long.
  • The program may not contain tabs, newlines, or non-printable ASCII (as they aren't in the grid).
  • The program should run and exit without errors.
  • There are no time or complexity constraints as long as the program would eventually terminate with finite output.
  • The grid does not loop around from left to right or top to bottom.

Please mention where your program appears in the grid so we can quickly verify that it really is there.

Calvin's Hobbies

Posted 2015-01-16T09:51:22.633

Reputation: 84 000

inb4 a "given a boggle board and a word, verify the word exists on this board" challenge. – John Dvorak – 2015-01-16T10:03:03.973

8Why the 4096 character rest... oh. – John Dvorak – 2015-01-16T10:04:56.443

2Maybe it would have been more interesting if the program had to solve an actual code golf problem, but be taken from the grid. – feersum – 2015-01-16T11:47:15.093

Clearly not a viable challenge for Mathematica, which has a mean function name length of 13 characters! – DavidC – 2015-01-16T15:17:39.130

2@DavidCarraher - Or for any non-golfing language actually. I found one instance of yes, for example. – None – 2015-01-16T15:48:27.493

@feersum I agree, though then solutions might even be less accessible for non-golfing languages. Maybe if I had weighted it so letters, spaces, and semicolons were more common. – Calvin's Hobbies – 2015-01-16T18:13:35.577

1TECO is not a golfing language...it is a tape/text editor dating from the 1960s. – feersum – 2015-01-16T23:06:18.020

1Looks like perfectly viable perl program at first glance... – DGM – 2015-01-17T00:48:58.070

@Calvin'sHobbies A sequel to this sounds fun – Sp3000 – 2015-01-17T09:16:23.020

Answers

15

CJam, over (81182737^2813292)↑↑(10604499373-1) chars

Okay I think I've finally sorted everything out. This was fun — coming up with the code was like navigating a minefield.


Before we dive in, let's start with a simpler example (try it online):

1 3{(\1\{(\5*\}h;\}h;

h is a do-while loop that leaves the condition on the stack, and {} are code blocks. The inner block is:

(        Decrement
\        Swap top two of stack
5*       Push 5 and multiply
\        Swap back

Suppose the top of the stack is [1 10] and we perform the do-while {(\5*\}h;. This is what happens:

[1 10] --decrement--> [1 9]    --swap--> [9 1]    --multiply--> [9 5^1]  --swap--> [5^1 9]
       --decrement--> [5^1 8]  --swap--> [8 5^1]  --multiply--> [8 5^2]  --swap--> [5^2 8]
       --decrement--> [5^2 7]  --swap--> [7 5^2]  --multiply--> [7 5^3]  --swap--> [5^3 7]
       ...

This happens until the 10 decrements all the way down to 0 and the loop terminates, at which point we end up with [5^10 0] at the top of the stack. We can then use ; to pop the zero, leaving [5^10].

In other words we have just performed exponentiation, with [1 x]{(\5*\}h; resulting in [5^x].

The outer block {(\1\{(\5*\}h;\}h; is similar, but instead of the 5* in the middle we have our "exponentiate base 5" loop. So for our simple example, starting with [1 3] we get:

[1 3] -dec/swap-> [2 1]   -push 1-> [2 1 1]   -swap-> [2 1 1]   -5^-> [2 5]     -swap-> [5 2]
      -dec/swap-> [1 5]   -push 1-> [1 5 1]   -swap-> [1 1 5]   -5^-> [1 5^5]   -swap-> [5^5 1]
      -dec/swap-> [0 5^5] -push 1-> [0 5^5 1] -swap-> [0 1 5^5] -5^-> [0 5^5^5] -swap-> [5^5^5 0]

The top is zero, so we stop the loop and pop, leaving [5^5^5]. In other words, we have just created 5^5^5, or 5↑↑3 in Knuth's up arrow notation. You can switch 5 and 3 for other numbers but hyperexponentiation gets big fast, so I wouldn't recommend picking anything too large.


Now for the real thing:

1B);0D+9#{z(J Y=A*;\VC#UooJ87<W5^o\OO>;J6%_9=+NpXzH|>!p{Kdp(_E=XIK21^%^Z&&p\Y~!E<432|T|Z#00I0*boW)I^8227(*JEo*#09;*7XH+G^o9=pWdK>(2P-*I\6539K~>)#D@</CJ1(+^po\F"U$(jX?a"apV\|;}_V);;D00&phVA^^6pJP\<%o\8H>V1^+aoXY-Y&41-X)8/o!Jb;}"}:rM)<W?o:p'";h

(Path trace)

Anotated (anything without notes is filler):

1                                           Push 1
B);
0D+9#                                       Push 13^9 = 10604499373
{                                           Start outer block
z
(                                           Decrement
J Y=A*;
\                                           Swap
VC#Uoo
J87<                                        Push 1
W5^o
\                                           Swap back
OO>;
J6%_9=+NpXzH|>!p
{                                           Start inner block
Kdp
(                                           Decrement
_E=XIK21^%^Z&&p
\                                           Swap
Y~!E<432|T|Z#00I0*boW)I^8227(*JEo*#         Push 81182737^2813292, <output 3 chars>
09;
*                                           Multiply by previous large number
7XH+G^o9=pWdK>(2P-*I\6539K~>)#D@</CJ1(+^po
\                                           Swap back
F"U$(jX?a"apV\|;
}                                           End inner block
_V);;
D00&p
h                                           Perform inner do-while loop
VA^^6pJP\<%o                                Pop top of stack by outputting
\                                           Swap back
8H>V1^+aoXY-Y&41-X)8/o!Jb;
}                                           End outer block
"}:rM)<W?o:p'";
h                                           Perform outer do-while loop

It's basically the same as the simple example, just with a lot of filler while navigating from one instruction to another in the grid.

Instead of 5 and 3 we have 81182737^2813292 and 10604499373, meaning that (81182737^2813292)↑↑10604499373 gets outputted at the end (given enough time and memory, of course!). Note that this is merely a lower bound — there's a lot of other printing that takes place, e.g. with 6 and 3 the output is over 2 million chars long even though 6^6^6 has only 36k digits.

If you want to try this full version for yourself, test with:

1B);
3
{z(J Y=A*;\VC#UooJ87<W5^o\OO>;J6%_9=+NpXzH|>!p{Kdp(_E=XIK21^%^Z&&p\
5
09;*7XH+G^o9=pWdK>(2P-*I\6539K~>)#D@</CJ1(+^po\F"U$(jX?a"apV\|;}_V);;D00&phVA^^6pJP\<%o\8H>V1^+aoXY-Y&41-X)8/o!Jb;}"}:rM)<W?o:p'";h

replacing the 5 and 3 on the second and fourth lines with numbers of your choice. Note that the output will have a few extra digits around the important hyperexponentiated number (namely a preceding 010 and a trailing 0).


A few notes on CJam

You might we wondering: why not use CJam's inbuilt exponentiation (#) instead of the inner do-while loop? Unfortunately, after digging through CJam's source, I learnt that for exponentiation the base can be a BigInt (arbitrary precision) but the exponent gets converted to a normal 32-bit int. This has some amusing, but annoying side effects:

2 2 31# #     -->    java.lang.ArithmeticException: Negative exponent  (should be 2^2^31)
2 2 32# #     -->    1                                                 (should be 2^2^32)

This meant that I couldn't use CJam's builtin exponentation when the exponent is too large, for overflow reasons. However, multiplication is different as multiplying two BigInts results in a new BigInt, so I decided to exploit that instead.

Sp3000

Posted 2015-01-16T09:51:22.633

Reputation: 58 729

4Minute rule removed. Go crazy! – Calvin's Hobbies – 2015-01-16T11:06:23.320

7

TECO, ~2^31 * 13 ~= 27.9 * 10^9

?^e=<\RZK%B"svbk7,.c2z\R!Z~|bS|VM!2=9%MEX'1UC>

enter image description here

Edit: Changed a couple of characters because I accidentally reused one, but that part was inside a comment so it doesn't make much difference.

The ? turns on command echoing, which I use to create most of the output. Then the characters \RZK%B"s'1UC> are printed in a loop. %B"s adds one to B and then tests if it is less than zero. Thus, this conditional should be entered after 2^31 cycles when it overflows to a negative number. Inside the conditional there is an EX command which exits the program.

Currently I am attempting to run it to completion with the output directed to a file.

feersum

Posted 2015-01-16T09:51:22.633

Reputation: 29 566

"Currently I am attempting to run it to completion with the output directed to a file." I hope you have 27.9 GB (26 GiB) of free space, then... – John Dvorak – 2015-01-16T11:20:46.397

1@JanDvorak I have over 600 GB of free space... however it is proceeding so slowly it seems somehow unlikely to make it all the way. – feersum – 2015-01-16T11:21:45.953

-4

HQ9+ (17195 characters)

Source:

9Q9

(starts at 5:4 and then down)

Output:

The text to the song "99 bottles of beer" (8596 characters), the string 9Q9 (3 characters) and another copy of "99 bottles of beer" (8596 characters).

This is a very lame answer and you should not upvote it, but someone had to post it.

Philipp

Posted 2015-01-16T09:51:22.633

Reputation: 1 205