Slashdot Mirror


Obfuscated C Code Contest Begins

slashdot-me writes "The International Obfuscated C Code Contest (IOCCC) has begun. See the rules at the IOCCC homepage. The contest runs from Feb. 1 to March 31. " As always, the results will be only readable by Martians.

19 of 227 comments (clear)

  1. New contest by QZS4 · · Score: 3

    Oh yeah, so where's the obfuscated Intercal code contest?

    Oh, maybe we should drop that...

  2. A True Obfuscated function. by doomy · · Score: 3

    #define begin {
    #define end }
    #define if say
    #define yell printf
    #define else otherwise
    #define @ ;
    /* slash_posted returns a 1 if a new slashdot
    article has been posted */

    ac_poster_screams()
    say(slash_posted)
    begin
    yell("FIRST POST!")@
    end
    otherwise
    begin
    yell("Bill Gates Naked and Petrified!")@
    end
    end

    --

    --
    ...free your source and the rest would follow...
  3. Obfuscated PERL contest? by jabber · · Score: 3

    No need! It already comes that way!!

    I can code that in three APL glyphs!

    --

    -- What you do today will cost you a day of your life.
  4. Re:Shortest Self Duplicating C program by rebrane · · Score: 3
    You mean quines. The above page is a pretty exhaustive resource. Since it's relatively brief, here's (AFAIK) the shortest C quine:

    char*f="char*f=%c%s%c;main()
    {printf(f,34,f,34,10);}%c";
    main(){printf(f,34,f,34,10);}

    Check out the Intercal quine. It's the most painful piece of source I've ever seen (and I keep up with the ioccc).

    --neil

  5. past winners by jetpack · · Score: 3

    Since www.ioccc.org seems to be unreachable at the moment (at least for me), you can amuse yourself by looking at previous winning entries

    Have fun :)

  6. Single entries to multiple contests? by dsplat · · Score: 3
    It would be interesting to see a single valid entry that could be submitted to more than one Obfuscated Foo Code Contest. Here are some of the contest announcements (not all current):


    --
    The net will not be what we demand, but what we make it. Build it well.
  7. Re:One of my favorites... by Tim+Behrendsen · · Score: 3

    By the way, I just tried it under gcc (I haven't tried it in a long time), and unfortunately it doesn't appear to work anymore. :(

    Anyone want to take a crack at debugging it? :)

    For you young 'uns, tiny basic took line numbers. The following should work:

    10 for i = 0 to 10
    20 print i
    30 next i
    run

    I think it also has a full expression evaluator built in, so you can do some "let j = i * 10" type thing also.


    --

  8. That was easy :) by Otis_INF · · Score: 3

    10 print "In reality I'm an obfuscated version of msvcrt.dll"
    20 goto 10

    --
    Never underestimate the relief of true separation of Religion and State.
  9. For All You Young Bucks by ShelbyCobra · · Score: 3

    Perhaps the same website should have an "old timer's league" as well.

    I can see it now "The Grande Olde Obfuscated FORTRAN Code Contest"

    --

    -ShelbyCobra

    Living life in the right side of the s-plane

  10. css-auth anyone by Anonymous Coward · · Score: 4

    I don't have the time, but an obviscated css-auth formated in the shape of the DVD logo would be neat. You could print it on t-shirts and the like without people realizing what they are looking at.

  11. Unfortunately... by jd · · Score: 4

    The Martian entry, due to be received by the Mars Lander and beamed back to Earth in time for this year's contest, was disqualified on account of being too obscure, causing the main on-board computer to explode.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  12. Re:One of my favorites... by MbM · · Score: 4
    correction to above example,
    5th line after the #defines is

    (!Q(s,"\"")){U("",'#');U("=",'!');}d=B;while(*F=*s ){*s=='"'&&j


    after that it should compile with a few warnings
    reminder to use uppercase, most of the computers that ran this stuff didn't have working shift keys
    - MbM
    --
    - MbM
  13. www.ioccc.org by seebs · · Score: 4

    And yes, we're late. Sorry! It takes some coordination getting things set up.

    We've already got a number of entries. Remember, you can enter as often as you like.

    Many will enter! Some will win! Some will elicit reactions of abject terror!

    --
    My blog: http://www.seebs.net/log/ --- My iPhone/iPad app: http://www.seebs.net/seebsfrac/
  14. Re:Writing Unintelligeable code by Azog · · Score: 4

    Here's the core of an email I just sent as an update to the unmaintainable code document.

    But my experience is so awful I must share the agony with as many as possible. So here you are - another way to write unmaintainable code...

    (cue creepy music)
    --------------------------------------

    When implementing a very complicated algorithm, use the classic software engineering principles of doing a sound design before beginning coding. Write an extremely detailed design document that describes each step in a very complicated algorithm. The more detailed this document is, the better.

    In fact, the design doc should break the algorithm down into a hierarchy of structured steps, described in a hierarchy of auto-numbered individual paragraphs in the document. Use headings at least 5 deep. Make sure that that when you are done, you have broken the structure down so completely that there are over 500 such auto-numbered paragraphs. For example, one paragraph might be: (this is a real example)

    1.2.4.6.3.13 - Display all impacts for activity where selected mitigations can apply
    (short pseudocode omitted).

    THEN... (and this is the kicker) when you write the code, for each of these paragraphs you write a corresponding global function named:

    Act1_2_4_6_3_13()

    Do not document these functions. After all, that's what the design document is for! HAHAHAHAHAHA!

    Since the design doc is auto-numbered, it will be extremely difficult to keep it up to date with changes in the code (because the function names, of course, are static, not auto-numbered.) This isn't a problem for you because you will not try to keep the document up to date. In fact, do everything you can to destroy all traces of the document.

    Those who come after you should only be able to find one or two contradictory, early drafts of the design document hidden on some dusty shelving in the back room near the dead 286 computers.

    ---------------------------

    Here's a real-life typical code snippet produced using this diabolical method:

    if (pProject->GetSecImpactStore()->ConnectedToPrimary (pSuccImpact))
    {
    wPrevFD= pSuccImpact->GetFD();
    wPrevECD= pSuccImpact->GetECD();
    wPrevEUCD= pSuccImpact->GetEUCD();

    // Act 1.2.4.6.4.11.7 recompute firing degrees, given different predecessors
    // (this is identical to Act 1.2.4.6.3.13)
    Act1_2_4_6_3_13(pSuccImpact, pProject->GetSecImpactStore());

    // Then propagate I2, given that its firing degrees may have changed
    Act1_2_4_6_4(pSuccImpact, wPrevFD, wPrevECD, wPrevEUCD, pInfEng, pProject, pSecRules);
    }
    else
    {
    // No other predecessors, so depropagate I2 also (recursion)
    if (!pStack->IsMember(pSuccImpact))
    {
    Act1_2_4_6_4_11( pInfEng, pProject, pSuccImpact, pSecRules, pStack );

    // Act 1.2.4.6.4.11.10 Then kill impact I2
    Act1_2_4_6_4_11_10( pInfEng, pProject, pSuccImpact, pProject->GetSecImpactStore() );
    }
    }

    This goes on for thousands of lines.
    --------------------------------------

    Thank you for sharing my pain.

    Torrey Hoffman (Azog)

    --
    Torrey Hoffman (Azog)
    "HTML needs a rant tag" - Alan Cox
  15. forget obfuscated C by / · · Score: 4

    I'm more interested in the obfuscated-justice contest they're having over at the Superior Court of the State of California County of Santa Clara. I keep trying to compile their efforts, but all I get is "error: INJUSTICE". Maybe I'm using the wrong Constitution? Does anyone have a totalitarian-state constitution I can link against? Maybe the old CCCP constitution?

    --
    "If one is really a superior person, the fact is likely to leak out without too much assistance" -- John Andrew Holmes
  16. Re:Found this on my HD by Inoshiro · · Score: 4
    Slashdot ate part of the code, both the perl and the C.. It's the preview but they haven't fixed. Damnit.. (I also hit submit instead of preview by accident -- Rob, could we have those on separate sides of the format specifier?)... Have fun

    #include <stdio.h>
    main(t,_,a)char *a;{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
    main(-86,0,a+1)+a)):1,t<_?main(t+1,_,a):3,main(-94 ,-27+t,a)&&t==2?_<13?
    main(2,_+1,"%s %d %d\n"):9:16:t<0?t<-72?main(_,t,
    "@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q #n+,/#{l+,/n{n+,/+#n+,/#\
    ;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l \
    q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w '){){nl]'/+#n';d}rw' i;# \
    ){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' \
    iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
    ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w ! nr'/ ') }+}{rl#'{n' ')# \
    }'+}##(!!/")
    :t<-50?_==*a?putchar(31[a]):main(-65,_,a+1):main(( *a=='/')+t,_,a+1)
    :0<t?main(2,2,"%s"):*a=='/'||main(0,main(-61,*a,
    "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}




    #!/usr/bin/perl -p
    #
    # code2html - convert code to html for posting to slashdot
    #
    # tchrist@perl.com
    # Sunday, December 19th, 1999
    BEGIN { print "<TT>\n" }# and the spirit of awk...
    # first kill all the tabs
    1 while s{ \t + }
    { " " x (length($&)*8 - length($`)%8) }ex;
    # then the four standard naughty bits
    s/&/&amp;/g;# must remember to do this one first!
    s/</&lt;/g;# this is the most important one
    s/>/&gt;/g;# don't close too early
    s/"/&quot;/g;# only in embedded tags, i guess
    # make lines break where they should
    s/^\s*$/<P>/ || s/$/<BR>/;
    # make sure spaces aren't squishticated so we
    # can do indentation and properly align comments
    s/( {2,})/'&nbsp;' x length($1)/ge;
    END { print "</TT>\n" }# ...shall be with us always

    ---

    --
    --
    Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
  17. Writing Unintelligeable code by thebruce · · Score: 4

    Here's a site for some pointers:

    http://mindprod.com/unmain.html

    Quite intriguing if you ask me :)

  18. 1988 Best Abuse Of The Rules by SEWilco · · Score: 5
    My favorite "Best Abuse Of the Rules" winner has always been spinellis.c

    In full:

    #include "/dev/tty"
  19. One of my favorites... by Tim+Behrendsen · · Score: 5

    Behold! A tiny BASIC interpreter that fits on one 24x80 screen:

    #define O(b,f,u,s,c,a)b(){int o=f();switch(*p++){X u:_ o s b();X c:_ o a b();default:p--;_ o;}}
    #define t(e,d,_,C)X e:f=fopen(B+d,_);C;fclose(f)
    #define U(y,z)while(p=Q(s,y))*p++=z,*p=' '
    #define N for(i=0;i<11*R;i++)m[i]&&
    #define I "%d %s\n",i,m[i]
    #define X ;break;case
    #define _ return
    #define R 999
    typedef char*A;int*C,E[R],L[R],M[R],P[R],l,i,j;char B[R],F[2];A m[12*R],malloc
    (),p,q,x,y,z,s,d,f,fopen();A Q(s,o)A s,o;{for(x=s;*x;x++){for(y=x,z=o;*z&&*y==
    *z;y++)z++;if(z>o&&!*z)_ x;}_ 0;}main(){m[11*R]="E";while(puts("OK"),gets(B)
    )switch(*B){X'R':C=E;l=1;for(i=0;i<R;P[i++]=0);whi le(l){while(!(s=m[l]))l++;if
    (!Q(s,"\"")){U("<>",'#');U("<=",'$');U(">=",'!');} d=B;while(*F=*s){*s=='"'&amp ;&j
    ++;if(j&1||!Q(" \t",F))*d++=*s;s++;}*d--=j=0;if(B[1]!='=')switch(* B){X'E':l=-1
    X'R':B[2]!='M'&&(l=*--C)X'I':B[1]=='N'?gets(p=B),P [*d]=S():(*(q=Q(B,"TH"))=0,p
    =B+2,S()&&(p=q+4,l=S()-1))X'P':B[5]=='"'?*d=0,puts (B+6):(p=B+5,printf("%d\n",S
    ()))X'G':p=B+4,B[2]=='S'&&(*C++=l,p++),l=S()-1 X'F':*(q=Q(B,"TO"))=0;p=B+5;P[i
    =B[3]]=S();p=q+2;M[i]=S();L[i]=l X'N':++P[*d]<=M[*d]&&(l=L[*d]);}else p=B+2,P[
    *B]=S();l++;}X'L':N printf(I)X'N':N free(m[i]),m[i]=0 X'B':_ 0 t('S',5,"w",N
    fprintf(f,I))t('O',4,"r",while(fgets(B,R,f))(*Q(B, "\n")=0,G()))X 0:default:G()
    ;}_ 0;}G(){l=atoi(B);m[l]&&free(m[l]);(p=Q(B," "))?strcpy(m[l]=malloc(strlen(p
    )),p+1):(m[l]=0,0);}O(S,J,'=',==,'#',!=)O(J,K,'<', <,'>',>)O(K,V,'$',<=,'!', >=)
    O(V,W,'+',+,'-',-)O(W,Y,'*',*,'/',/)Y(){int o;_*p=='-'?p++,-Y():*p>='0'&&*p<=
    '9'?strtol(p,&p,0):*p=='('?p++,o=S(),p++,o:P[*p++] ;}

    I hope that translated right... Slashdot "Plain Old Text" option is a little broken, so I had to do some HTML translation. Oh well, it gives you the flavor of the IOCCC, anyway.


    --