This is just for fun. Have you heard of "Obfuscated Code" contests? People write source code in C or PERL that's obfuscated -- that is, intentionally convoluted and difficult to follow. It can contain red herrings (misleading devices) or take advantage of deliberately improper syntax that's still somehow valid. Besides being a waste of time, it does have one practical aspect in that it defeats reverse engineering (but there goes all of Bob Zale's work to make his code fast and clean). Anyway, here's something I wrote tonight. Anyone got anything better?
Code:
#COMPILER PBCC 4 FUNCTION PBMAIN() AS LONG DIM s AS STRING:DIM n AS LONG:DIM x(1 TO 22) AS INTEGER:DIM r AS SINGLE RANDOMIZE TIMER:s="absolute woozy":r=RND:FOR n=1 TO 100:r=-.2/r-INT(-.2/r) NEXT n:x(21)=7*r:r=RND:FOR n=1 TO 100:r=-.2/r-INT(-.2/r):NEXT n:x(19)=3*r x(1)=INSTR(s,"l"):x(2)=GETATTR("c:\"+s)+TALLY(s,"o")+ERR MOD 3:ERRCLEAR x(3)=PARSECOUNT(s+s,"e")+3:x(4)=2-ERR:x(5)=SQR(LOWRD(ASC(LEFT$(s,1))))/2 SWAP x(5),x(3):x(6)=-SIN(56*x(4))-SIN(33*x(4))-LOG(12*x(4))-LOG(22*x(4)) x(7)=SQR(SQR(ASC(MID$(STRREVERSE$(s),4,3))))-x(1):x(8)=LEN(x(8))/(ERR+2) x(9)=x(6) AND x(5) AND x(4):x(22)=x(8)-x(9):x(10)=SQR(LEN(REPEAT$(4,s))_ -LEN(REPEAT$(3,s)))-1:x(11)=TAN(SIN(SQR(x(9))))-SIN(2):x(12)=UBOUND(x)/_ (0.8*LEN(s)):x(13)=INT(SQR(x(5)XOR x(8)*17)):x(14)=INT(1.65875845180E+18_ /2.64744936631435E+17):x(15)=x(7):x(16)=x(8):x(20)=x(10)+x(13) x(18)=x(19)-x(16):FOR n=x(18) TO x(10) STEP x(9):x(n)=x(n)-2*x(n):NEXT n FOR n=x(5)+x(20) TO 8*x(4):IF n MOD x(10)<>0 THEN x(n)=-x(n) NEXT n:FOR n=1 TO 22:PRINT MID$(s,7+x(n),1);:NEXT n:WAITKEY$:END FUNCTION
Comment