Computer Science Canada

Obfuscated Code Contest : Prize - 50GB FTP Account

Author:  Mackie [ Sat Feb 16, 2008 12:29 am ]
Post subject:  Obfuscated Code Contest : Prize - 50GB FTP Account

Alrighty folks. I have a 1TB web server and it's not getting used. So I've come up with a little contest to give away a piece of it. Since clean efficient code it staple of this site, I figure we should mix it up a little. The point is write the most confusing unsightly code possible, that still runs and does something useful. For a better definition just check Wikipedia. I will be the sole judge for this competition, because I really don't feel like coordinating anything. The code will be in Ruby. And no larger than 15KB.

If you don't like something about this contest, I don't care. It's my 50GB and I can do with it what I please.

Due Date: March 1st, 2008 (duh)

Post submissions in this topic. No one is going to take your code.

Let the games begin!

Quote:
Prize:
50,000MB FTP Account
50TB Bandwidth

Author:  Tony [ Sat Feb 16, 2008 1:00 am ]
Post subject:  Re: Obfusticated Code Contest : Prize - 50GB FTP Account

Mackie @ Sat Feb 16, 2008 12:29 am wrote:
And no larger than 15KB.

do you realize how many characters that is?

Author:  Mackie [ Sat Feb 16, 2008 1:10 am ]
Post subject:  RE:Obfusticated Code Contest : Prize - 50GB FTP Account

Ahhh, sorry typo. 150KB...

Author:  zylum [ Sat Feb 16, 2008 3:20 am ]
Post subject:  RE:Obfusticated Code Contest : Prize - 50GB FTP Account

I think 5KB is more than enough considering it's in ruby.. I personally would go for 1KB.

Author:  Mackie [ Sat Feb 16, 2008 4:00 am ]
Post subject:  RE:Obfusticated Code Contest : Prize - 50GB FTP Account

Oh man, I completely forgot.

Bonus Points for inefficiency! Razz

Author:  BigBear [ Sat Feb 16, 2008 9:56 am ]
Post subject:  Re: Obfusticated Code Contest : Prize - 50GB FTP Account

Due to the fact that I am fairly new it would be too hard. Too bad it's only in Ruby.

Nice setup though! Very Happy

Author:  Tony [ Sat Feb 16, 2008 12:23 pm ]
Post subject:  Re: RE:Obfusticated Code Contest : Prize - 50GB FTP Account

zylum @ Sat Feb 16, 2008 3:20 am wrote:
I personally would go for 1KB.

I second zylum on this one.

Author:  ericfourfour [ Sat Feb 16, 2008 3:38 pm ]
Post subject:  RE:Obfusticated Code Contest : Prize - 50GB FTP Account

Just some clarifications:

1 Character = 1 Byte

Base 10:
1 KB = 10^3 Bytes
1 MB = 10^6 Bytes
etc.

Base 2:
1 KiB = 2^10 Bytes
1 MiB = 2^20 Bytes
etc.

Author:  Mackie [ Sun Feb 17, 2008 1:12 pm ]
Post subject:  RE:Obfusticated Code Contest : Prize - 50GB FTP Account

Fine! If everyone is going to be so picky about it. No Size Limit. Also the prize FTP is going up to 60GB. Just because I'm in a good mood.

Author:  [Gandalf] [ Sun Feb 17, 2008 3:04 pm ]
Post subject:  RE:Obfusticated Code Contest : Prize - 50GB FTP Account

Haha, everyone is pushing to change the contest in one direction, and then Mackie changes it in the other. Laughing

Anyway, I'm going to go ahead and attempt a default win:
code:
puts "EYE WIHN"

Author:  Tony [ Sun Feb 17, 2008 3:15 pm ]
Post subject:  Re: RE:Obfusticated Code Contest : Prize - 50GB FTP Account

Gandalf @ Sun Feb 17, 2008 3:04 pm wrote:
Anyway, I'm going to go ahead and attempt a default win

Laughing lets get this party started
code:

puts "#{gets.strip} wins!"

Author:  Mackie [ Sun Feb 17, 2008 4:27 pm ]
Post subject:  RE:Obfusticated Code Contest : Prize - 50GB FTP Account

Tony's wining! Also big mistake on my part, I spelled obfuscated wrong... Just wanted to let everyone know before someone comes in and points it out making it look like an idiot. Razz

So I've got no problems if a Moderator wants to change that. Very Happy

Author:  Clayton [ Sun Feb 17, 2008 4:43 pm ]
Post subject:  Re: RE:Obfusticated Code Contest : Prize - 50GB FTP Account

Tony @ Sun Feb 17, 2008 3:15 pm wrote:
Gandalf @ Sun Feb 17, 2008 3:04 pm wrote:
Anyway, I'm going to go ahead and attempt a default win

Laughing lets get this party started
code:

puts "#{gets.strip} wins!"


Indeed:

Ruby:
puts "#{gets.strip!} wins!"

Author:  Mackie [ Thu Feb 28, 2008 9:02 pm ]
Post subject:  RE:Obfuscated Code Contest : Prize - 50GB FTP Account

ALright, seeing as there is such a small amount of interest in the contest. I guess I'll open it up a little bit.

New deadline is March 20th. I realize now that limiting it to Ruby was a mistake. Sooo....

Any language allowed!

Author:  Sane [ Fri Feb 29, 2008 1:14 am ]
Post subject:  RE:Obfuscated Code Contest : Prize - 50GB FTP Account

Here's my entry. It may or may not be final. IE, I might revise it some time before the deadline if someone raises the bar higher.

[b]Edit[b]: Some of the ASCII characters such as overscores didn't encode properly in my post. Oh well.

code:
#include                                <stdio.h>
#include                               <stdlib.h>
#include                                 <time.h>
#define V                                     '='
#define I                                 '='+'='
#define ZZZ                                   int
#define W                                   while
#define C()                         system("cls")

ZZZ X[0X763]={0},XX[0X763]={0};ZZZ XXXX,XXXXX;XXX
(){for(XXXX=1;XXXX<0X763;XXXX++){XXXXX=X[XXXX%I*(
XXXX/V)-'>']+X[XXXX%I*(XXXX/V)-V]+X[XXXX%V-'<'+V*
(XXXX/V)]+X[XXXX%V-1+/*??*/V*(XXXX/V)]+X[XXXX%V+1
+V*(XXXX/V)]+X[XXXX%V/*  */+'<'+V*(XXXX/V)]+ X [
XXXX%I*(XXXX/V)+V]+ X/*__*/[XXXX%I*(XXXX/V)+'>'];
XX[XXXX%I*(XXXX/V)]=X[XXXX%I*(XXXX/V)]&&XXXXX<2?0
:X[XXXX%I*(XXXX/V)]&&XXXXX>3/*??*/?0:!X[XXXX%I* (
XXXX/V)]&&XXXXX==3?1:X[XXXX%/*  */I*(XXXX/V)]  ;}
memcpy(X,XX,sizeof(X));for (/*__*/XXXX=1 ; XXXX <
0X763;XXXX++){putchar(X[XXXX%I*(XXXX/V)]?'#':' ')
;XXXXX=(!(XXXX/*??*/%/*??*/V/*??*/))?putchar(10):
0;}sleep(0X190/*  */)/*  */;/*  */C();}main( ) {;
;{}; X[0X3A2]=/*__*/X/*__*/[/*__*/0X3A3]=X[0X3A4]
=X[0X3A7]=X[0X3A8]=X[0X3E2]=X[0X421]=1;W(X)XXX();

/////////////////////////////////////////////////
char CC[]=  "Conway's Game Of Life"            ;}
/////////////////////////////////////////////////

Author:  Wolf_Destiny [ Fri Feb 29, 2008 2:24 pm ]
Post subject:  Re: Obfuscated Code Contest : Prize - 50GB FTP Account

Alright, time to throw my hat into the ring. Since it can be any language, I made one. Similar commands to Brainf**k, but it reads a bmp. All the commands are described in the program with the help option it gives. The compiler is written in Turing and is pretty basic. Type -? as the filename for more description. The program itself is a simple fizzbuzz program.
Compiler: 008-Distrib.t (attached)
Program: FizzBuzz-final.bmp (attached)

Author:  OneOffDriveByPoster [ Tue Mar 04, 2008 9:58 pm ]
Post subject:  Re: Obfuscated Code Contest : Prize - 50GB FTP Account

Half intentional, half unintentional obfuscated code. It tries to read whitespace separated tokens and returns when the current token is not a valid double.
It has the advantage that it does not look all that obfuscated if people are skimming through your code (I think).
c++:
#include <iostream>
#include <sstream>
#include <new>

using namespace std;

int main(void) {

    string tok; char junk; stringstream ss;
    double n;

    while ( cin >> tok, cin && (ss.~stringstream(), new (&ss) stringstream(tok), (ss >> n) && !(ss >> junk)) ) {
        cout << n << endl;
    }

    cout << "Not valid double value or input error; bye!" << endl;
    return 0;
}

Author:  Sane [ Wed Mar 05, 2008 9:17 am ]
Post subject:  Re: Obfuscated Code Contest : Prize - 50GB FTP Account

Updated my submission slightly. Might make another fancy one.


C:
#include                                <stdio.h>
#include                               <stdlib.h>
#include                                 <time.h>
#define v                                     '='
#define i                                 '='+'='
#define w                                   while
#define _()                         system("cls")
int c[0X763]={0},cc[0X763]={0};int cccc,ccccc;ccc
(){for(cccc=1;cccc<0X763;cccc++){ccccc=c[cccc%i*(
cccc/v)-'>']+c[cccc%i*(cccc/v)-v]+c[cccc%v-'<'+v*
(cccc/v)]+c[cccc%v-1+      v*(cccc/v)]+c[cccc%v+1
+v* (cccc/v)]+c[cccc%      v+'<'+v*(cccc/v)]+ c [
cccc%i*(cccc/v)+v]+ c      [cccc%i*(cccc/v)+'>'];
cc[cccc%i*(cccc/v)]=c[cccc%i*(cccc/v)]&&ccccc<2?0
:c[cccc%i*(cccc/v)]&&ccccc>3      ?0:!c[cccc%i* (
cccc/v)]&&ccccc==3?1:c[cccc%      i*(cccc/v)]  ;}
memcpy(c,cc,sizeof(c));for (      cccc=1 ; cccc <
0X763;cccc++){putchar(c[cccc%i*(cccc/v)]?'#':' ')
;ccccc=(!(cccc      %      v      ))?putchar(10):
0;}sleep(0X190      )      ;      _();}main( ) {;
;{}; c[0X3A2]=      c      [      0X3A3]=c[0X3A4]
=c[0X3A7]=c[0X3A8]=c[0X3E2]=c[0X421]=1;w(c)ccc();
char __[]=  "Conway's Game Of Life"            ;}


And here's some screenshots of it in action:

Posted Image, might have been reduced in size. Click Image to view fullscreen.

Author:  nike52 [ Thu Mar 13, 2008 11:45 am ]
Post subject:  Re: Obfuscated Code Contest : Prize - 50GB FTP Account

Woah, some pretty fancy code in this thread. @_@ mind boggling

Author:  Mackie [ Thu Mar 20, 2008 12:21 pm ]
Post subject:  RE:Obfuscated Code Contest : Prize - 50GB FTP Account

Alright! Finally March 20th! I think? So anyway. SO without a whole lot of hulibbulloo, Sane one!

So, Sane PM with your desired name and password for your 60GB FTP Account.

Author:  Sane [ Thu Mar 27, 2008 6:58 pm ]
Post subject:  RE:Obfuscated Code Contest : Prize - 50GB FTP Account

Weeh! Thanks a lot. I've been in need of some extra disk space. PM is on its way.

Thanks again.


: