Close

Results 1 to 16 of 16
  1. #1
    DF VIP Member
    RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,780
    Thanks
    20
    Thanked:        13
    Karma Level
    389

    The most amazing bit of code I've seen

    Try compiling this:

    #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);
    }


    If it doesn't work then use the attached file.

    I have tried it on Windows and HPUX/Linux and here's what it produces:

    On the first day of Christmas my true love gave to me
    a partridge in a peaar tree.

    On the second day of Christmas my true love gave to me
    two turtle doves
    and a partridge in a peaar tree.

    On the third day of Christmas my true love gave to me
    three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the fourth day of Christmas my true love gave to me
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the fifth day of Christmas my true love gave to me
    five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the sixth day of Christmas my true love gave to me
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the seventh day of Christmas my true love gave to me
    seven swans a-swimming,
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the eigth day of Christmas my true love gave to me
    eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the ninth day of Christmas my true love gave to me
    nine ladies dancing, eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the sixth day of Christmas my true love gave to me
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the seventh day of Christmas my true love gave to me
    seven swans a-swimming,
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the eigth day of Christmas my true love gave to me
    eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the ninth day of Christmas my true love gave to me
    nine ladies dancing, eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the tenth day of Christmas my true love gave to me
    ten lords a-leping,
    nine ladies dancing, eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the eleventh day of Christmas my true love gave to me
    eleven pipers piping, ten lords a-leping,
    nine ladies dancing, eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.

    On the twelfth day of Christmas my true love gave to me
    twelve drummers drumming, eleven pipers piping, ten lords a-leping,
    nine ladies dancing, eight maids a-milking, seven swans a-swimming,
    six geese a-laying, five gold rings;
    four caalling birds, three french hens, two turtle doves
    and a partridge in a peaar tree.


    Now that's what I call an amazing bit of code ... there are some spelling errors ... but who cares.

    Anyone have others?

  2. #2
    DF VIP Member Mark_1983's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    104
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Default

    Call me dumb but how do you compile that bit of code?

    I've tried to compile it in borland and in visual c++ and no joy.

  3. #3
    DF VIP Member
    RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,780
    Thanks
    20
    Thanked:        13
    Karma Level
    389

    Default

    It seems that the new forum still has some quirks ... eg attachments missing and it has parsed the text wrongly.

    But basically in VC++ you use the wizard to create a blank console mode application and then add the file to the project.

    When the forum is working hunky-dorey I'll update this thread with the code and attachment.

  4. #4
    DF VIP Member salvadorescobar's Avatar
    Join Date
    Dec 2000
    Location
    Huddersfield
    Posts
    951
    Thanks
    0
    Thanked:        0
    Karma Level
    346

    Default

    This looks like ANSI c as well. So you should be able to compile it in any C compiler.
    'If we aren't meant to eat animals, then why are they made out of meat?'
    Anon.

  5. #5
    DF Rookie Snake_03's Avatar
    Join Date
    Jan 2003
    Location
    USA
    Posts
    1
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Default that code will never compile

    What language is tha? There are to many sytax errors for it to compile, you must be joking.

  6. #6
    DF VIP Member
    RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,780
    Thanks
    20
    Thanked:        13
    Karma Level
    389

    Default

    I'll post the original code later today now that Raptor has fixed attachments.

  7. #7
    DF VIP Member
    RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,780
    Thanks
    20
    Thanked:        13
    Karma Level
    389

    Default

    As promised, here is the code.

    I have wrapped it up in an MSDev console app project; but as I said it works on most platforms.
    Last edited by RhinoBanga; 11th March 2003 at 11:41 AM.

  8. #8
    DF VIP Member WTD's Avatar
    Join Date
    Mar 2001
    Location
    Tokyo, Japan
    Posts
    3,256
    Thanks
    0
    Thanked:        0
    Karma Level
    492

    Default

    Thanks RB, most impressive..

    Bollocks to debuging any logic errors in that though

  9. #9
    DF VIP Member
    RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,780
    Thanks
    20
    Thanked:        13
    Karma Level
    389

    Default

    Even after all this time I still haven't managed to figure out how it works :/

  10. #10
    DF Rookie echo7's Avatar
    Join Date
    Nov 2002
    Location
    NYC
    Posts
    2
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Default heh

    jdickson was the famous person who created ekk.exe
    phagish

  11. #11
    DF VIP Member
    RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,780
    Thanks
    20
    Thanked:        13
    Karma Level
    389

    Default

    All I did was wrap it up.

  12. #12
    DF Rookie RodTerl's Avatar
    Join Date
    Mar 2003
    Location
    Rossendale, UK
    Posts
    9
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Obd code

    Um, Im not sure, Id have to get my little manual on C coding, but I think it may be using pointers to code, using the ASCII values of the text to be created, with the read out being a recursive structure.

    I can have a go at writing my own versin, and see what I come up with if anyone wants. 8)

    RodTerl

  13. #13
    DF Rookie RodTerl's Avatar
    Join Date
    Mar 2003
    Location
    Rossendale, UK
    Posts
    9
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Oops.

    I believe the recursion bit is correct, but a second glance, at some of the numbers used, I think he may have used ROT13 encryption, also with direct program code access using offsets.

    I was brought up on a ZX Spectrum, so Ive seen a small amount of highly efficient code. 8)

    RodTerl

  14. #14
    DF Rookie newty's Avatar
    Join Date
    Dec 2002
    Location
    UK
    Posts
    2
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Default Re: heh

    Originally posted by echo7
    jdickson was the famous person who created ekk.exe
    phagish
    The code was actually written by Ian Phillipps for a competition "The International Obfuscated C Contest" in 1988, which he won.

    This goals of this contest are :

    To write the most Obscure/Obfuscated C program.
    To show the importance of programming style, in an ironic way.
    To stress C compilers with unusual code.
    To illustrate some of the subtleties of the C language.
    To provide a safe forum for poor C code.

    Here's a commented disassembly of the code :

    http://sigbeer.org/~mike/old/virginia/xmassong/

  15. #15
    DF VIP Member
    RhinoBanga's Avatar
    Join Date
    Nov 2000
    Location
    127.0.0.1
    Posts
    1,780
    Thanks
    20
    Thanked:        13
    Karma Level
    389

    Default

    /me will sleep better at night now!


    Thanks for that dude ... cool first post

  16. #16
    DF Rookie RodTerl's Avatar
    Join Date
    Mar 2003
    Location
    Rossendale, UK
    Posts
    9
    Thanks
    0
    Thanked:        0
    Karma Level
    0

    Wow

    Thank you very much for the link. Im just glad I got parts of the thing correct. 8}

    RodTerl

    Is it better to be one tenth correct, than totally wrong?

    8}

Similar Threads

  1. Code for Blaupunkt Car 300 Radio?
    By fais in forum Radio Decoding
    Replies: 8
    Last Post: 30th March 2004, 03:38 PM
  2. 3210 Security Code Problem
    By schematic in forum Unlocking Questions & Solutions
    Replies: 2
    Last Post: 18th September 2002, 01:40 AM
  3. nokia 5110 puk code
    By MAURICEMERSEYSI in forum Unlocking Questions & Solutions
    Replies: 1
    Last Post: 8th September 2002, 11:16 PM
  4. sony z5:security code
    By Danger Mouse in forum Unlocking Questions & Solutions
    Replies: 1
    Last Post: 6th September 2002, 05:41 PM
  5. Eurotunnel cheap fare or discount code - priviledge member?
    By shedsounds in forum Cheapskates Corner
    Replies: 2
    Last Post: 5th September 2002, 10:21 AM

Social Networking Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •