Obfuscated Coding Contest
Author |
Message |
md
|
Posted: Sat Feb 05, 2005 9:54 am Post subject: (No subject) |
|
|
C:
code: |
int main(void){printf("Hello world!");}
|
haha! I win! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
rizzix
|
Posted: Sat Feb 05, 2005 11:34 am Post subject: (No subject) |
|
|
here's a rather simple, yet amusing one:
Perl: | #!/usr/bin/perl
sub says {print shift} sub hi {v72. 101. 108. 108. 111. 32. shift}
sub to {shift().v10 } sub all {v87. 111. 114. 108. 100. 33}
sub UNIVERSAL:: AUTOLOAD {}
Perl, says hi to all and yes this entire sentence is part of the executable code |
|
|
|
|
|
|
Martin
|
Posted: Sat Feb 05, 2005 11:34 am Post subject: (No subject) |
|
|
I'm going to put this up to a vote. It will be a combination of the artisticness and the unreadability of the code. |
|
|
|
|
|
Martin
|
Posted: Sun Feb 06, 2005 8:06 pm Post subject: (No subject) |
|
|
Contest closed. 200 bits to bugz, 100 bits to BrightGuy.
Good job everyone |
|
|
|
|
|
rizzix
|
Posted: Sun Feb 06, 2005 8:30 pm Post subject: (No subject) |
|
|
sadly only three eligible persons participated in the contest |
|
|
|
|
|
Catalyst
|
Posted: Sun Feb 06, 2005 8:56 pm Post subject: (No subject) |
|
|
too late but oh well
c++: |
#include <iostream>
#define __for(a,b) int _it=b;_it<(int)(a*100);_it++
#define _ghy(a) a++
#define _ghz(a) a--
#define ghj 255
#define sif else if
#define sql(a) c[a]
#define loop_h(b) if (sql(_it)==c[b])
int main(int argc, char *argv[])
{
int m[1000];int _p;for(__for(10,0)){m[_it]=_p=0;}
char c[350]="ebzdafghifklmnopqrtsuvwxycaahav$aayauanaaafcanaaaca$ahavaayauanaaa$canaaanaaadddbgcccaaedaeanaa\
anaaaee$anaaedanaaa$edanaafcbmbnbb$dbgcecaahavaay$auaaeb$mbnbbbmbnbbeaa\
aebmbnbb$bbebmbnbbbmbnbbeddana$afcanaaad$bgcaaedaahava$ayauanaaae";
for (__for(3,26)){
loop_h(4) {_ghy(m[_p]);} loop_h(1) {_ghz(m[_p]);}
loop_h(25) {_ghy(_p);} loop_h(3) {_ghz(_p);}
loop_h(0) {std::cout<<(char)(m[_p]);}
loop_h(9) {if (m[_p]==0) {for(;c[_it+1]!=c[6];){_it++;}}}
loop_h(6) {if (m[_p]!=0) {for(;c[_it+1]!=c[9];){_it--;}}}
}
}
|
|
|
|
|
|
|
rizzix
|
Posted: Sun Feb 06, 2005 9:04 pm Post subject: (No subject) |
|
|
yea i think martin should extend the contest by another two weeks.
(i'm expecting more to contribute) |
|
|
|
|
|
rizzix
|
Posted: Sun Feb 06, 2005 9:07 pm Post subject: (No subject) |
|
|
catalyst, ur code does not compile (using g++ 3.4) |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Catalyst
|
Posted: Sun Feb 06, 2005 9:13 pm Post subject: (No subject) |
|
|
hmm, ive been editing it, try now
edit: new code works using gcc 3.3.1 |
|
|
|
|
|
rizzix
|
Posted: Sun Feb 06, 2005 9:15 pm Post subject: (No subject) |
|
|
awesome, works |
|
|
|
|
|
Martin
|
Posted: Sun Feb 06, 2005 9:53 pm Post subject: (No subject) |
|
|
Alright, contest is extended for two more weeks, ending on the Sunday. |
|
|
|
|
|
Catalyst
|
Posted: Thu Feb 10, 2005 1:41 am Post subject: (No subject) |
|
|
c++: |
#include <iostream>
#define __for(a,b) int _it=b;_it<(int)(a*100);_it++
#define _h(a,b) (c[_it]==c[a]||c[_it]==c[b])&&c[_it]==c[a]
#define _h2(a,b) (c[_it]==c[b])
int main(int argc, char *argv[])
{
int m[1000];int _p,inc=0,_b=-1;for(__for(10,0)){m[_it]=_p=0;}
char c[350]="ebzdafghifklmnopqrtsuvwxycaahav$aayauanaaafcanaaaca$ahavaayauanaaa$canaaanaaadddbgcccaaedaeanaa\
anaaaee$anaaedanaaa$edanaafcbmbnbb$dbgcecaahavaay$auaaeb$mbnbbbmbnbbeaa\
aebmbnbb$bbebmbnbbbmbnbbeddana$afcanaaad$bgcaaedaahava$ayauanaaae";
for (__for(3,26)){
_h(4,1)?m[_p]++:_h2(4,1)?m[_p]--:_b=_b;
_h(25,3)?_p++:_h2(25,3)?_p--:_p=_p;
if (_h2(25,0))std::cout<<(char)(m[_p]);
_h(9,6)?(m[_p]==0?_b=1:_b=0):_h2(9,6)?(m[_p]!=0?_b=1:_b=0):_p=_p;
m[_p]==0&&_b==1?inc=1:_b=_b; m[_p]!=0&&_b==1?inc=-1:_it=_it;
for(;c[_it+1]!=c[(inc>0?6:9)]&&_b==1;){_it+=inc;}
}
}
|
better now |
|
|
|
|
|
rizzix
|
Posted: Mon Sep 19, 2005 7:54 pm Post subject: (No subject) |
|
|
ehm you guys.. need to repost... cuz of the rollback we lost everything in that week.. |
|
|
|
|
|
[Gandalf]
|
Posted: Mon Sep 19, 2005 8:12 pm Post subject: (No subject) |
|
|
Sigh... And I spent a whole hour doing my crappy trial. Luckily, I saved it .
Turing: | var l: array 1..26of char:= init('p', 'o', 'i', 'u', 'y', 't', 'r', 'e', 'w', 'q', 'l', 'k', 'j', 'h', 'g', 'f', 'd', 's', 'a', 'm', 'n', 'b', 'v', 'c', 'x', 'z')
var w:=l (8* 2- 2)+l (14div 2+ 1)+l (16- 6+ 1)+l (18+ 5- 12)+l (22- 21+ 1)+ chr(43- 11)+ chr(upper(l )+ 93)+l (5div 3+ 1)+l (round(9* 0. 81))+l (round(21/ 2))+l (12- 2+ 7)
for i: 1.. length(w )
put chr(ord(w (i ))* round(sqrt(4))div(4/ 2))..
end for |
|
|
|
|
|
|
beard0
|
Posted: Mon Sep 19, 2005 8:27 pm Post subject: (No subject) |
|
|
Ah yes, here goes:
(Again, idea from Tony, whose program incidentally does not work)
code: | var hw := "++++++++[>++++[>++>+++>+++>+<<<<-]>+>->+>>+[<]<-]"
hw += ">>.>>---.+++++++..+++.>.<<-.>.+++.------.--------.>+.>++.#"
proc runprog (prog : string)
var w := Window.Open ("text,title:BF Run Window,position:0;0")
var cell : array 1 .. 300000 of int
for i : 1 .. upper (cell)
cell (i) := 0
end for
var c : string (1)
var i := 1
var p := 1
loop
c := prog (p)
exit when c = "#"
if c = ">" then
i += 1
p += 1
elsif c = "<" then
i -= 1
p += 1
elsif c = "+" then
cell (i) += 1
if cell (i) = 256 then
cell (i) := 0
end if
p += 1
elsif c = "-" then
cell (i) -= 1
if cell (i) = -1 then
cell (i) := 255
end if
p += 1
elsif c = "[" and cell (i) = 0 then
var a := 0
loop
p += 1
exit when p > upper (prog)
c := prog (p)
if c = "[" then
a += 1
elsif c = "]" and a > 0 then
a -= 1
elsif c = "]" and a = 0 then
exit
end if
end loop
elsif c = "[" and cell (i) not= 0 then
p += 1
elsif c = "]" and cell (i) not= 0 then
var a := 0
loop
p -= 1
c := prog (p)
if c = "]" then
a += 1
elsif c = "[" and a > 0 then
a -= 1
elsif c = "[" and a = 0 then
exit
end if
end loop
elsif c = "]" and cell (i) = 0 then
p += 1
elsif c = "." then
put chr (cell (i)) ..
p += 1
elsif c = "," then
var inp : string (1)
getch (inp)
cell (i) := ord (inp)
p += 1
elsif c = "#" then
exit
else
p += 1
end if
exit when p > length (prog)
end loop
end runprog
runprog (hw) |
Edit: Changed const to var in the first line of code |
|
|
|
|
|
|
|