Glaiel-Gamer
Guest
|
|
« on: January 15, 2009, 08:44:13 PM » |
|
The name of the game is the obfuscation game. I wrote a piece of obfuscated code here, compilable in c and c++. The goal of the game is for you to figure out what the code does, and how it does it. The first person to get it gets to post their own piece of stupid code for everyone else to decipher (please don't just paste the code from the wikipedia article on obfuscated code, it's really easy to find and it's really fun to write your own stupid code) #include <stdio.h> #define _____ return #define ____ int #define _______ "0x%X" ____ _(____ __,____ ___){_____ ___>__-__?_(++__,--___): __;}____ __(____ ______,____ ___){_____ ___>___/___?_( ______,__(______, --___)):______;}____ main(){____ ___ ;printf(_______,___=__(19,231));_____ ___/___;} /*change the numbers for different input*/
|
|
|
Logged
|
|
|
|
increpare
Guest
|
|
« Reply #1 on: January 15, 2009, 08:55:22 PM » |
|
Ackermann? (I haven't actually run it, just a guess based on how it looks; judging by the input numbers, I'd guess not, though...)
|
|
|
Logged
|
|
|
|
Glaiel-Gamer
Guest
|
|
« Reply #2 on: January 15, 2009, 08:58:43 PM » |
|
no
HINT: It's a really stupid way of computing a really simple operation
|
|
|
Logged
|
|
|
|
increpare
Guest
|
|
« Reply #3 on: January 15, 2009, 09:00:48 PM » |
|
oh right, multiplication?
(you do it like ackermann, though!)
|
|
|
Logged
|
|
|
|
Glaiel-Gamer
Guest
|
|
« Reply #4 on: January 15, 2009, 09:04:02 PM » |
|
ya that's right. recursive multiplication and recursive addition functions are in there. Your turn!
|
|
|
Logged
|
|
|
|
increpare
Guest
|
|
« Reply #5 on: January 15, 2009, 09:05:15 PM » |
|
ok...gimme a sec...
|
|
|
Logged
|
|
|
|
increpare
Guest
|
|
« Reply #6 on: January 15, 2009, 09:50:07 PM » |
|
#include <iostream> #define __ int #define ___ unsigned #define ____ return #define _____ main __ _(__ _______, __ ______);__ _(___ __ _______, __ ______);__ _(__ _______, __ ______){ ____ ______>0 ? _((__) ++_______, (___ __) --______): _((___ __) _______, (__) _______);}__ _(___ __ _______, ___ __ ______);__ _(__ _______, ___ __ ______){ ____ ______>1? _((___ __)_______,(___ __)_((__) _______, (___ __) --______)): _______; }__ _(___ __ _______, __ ______){ ____ _((__) _______, (___ __) ______);}__ _(___ __ _______, ___ __ ______){ ____ ______>0 ? _((___ __)++ _______,(___ __)--______):_______;}__ _____() { std::cout << _((__)19,(__)231) << std::endl; ____ 0;} yet another function of two variables
|
|
|
Logged
|
|
|
|
Gold Cray
|
|
« Reply #7 on: January 15, 2009, 11:59:29 PM » |
|
I turned it into something more legible, but it's a bit late (early) for me to decode the rest. I'll try again tomorrow (later today) if someone else hasn't figured it out yet. #include <iostream>
int A(int X, int Y); int B(int X, int Y); int C(int X, int Y); int D(int X, int Y);
int A(int X, int Y) { return Y>0 ? B(++X, --Y): C(X, X); } int B(int X, int Y) { return Y>1 ? D(X, B(X, --Y)): X; } int C(int X, int Y) { return B(X, Y); } int D(int X, int Y) { return Y>0 ? D(++X, --Y): X; }
int main() { std::cout << A(19, 231) << std::endl; return 0; }
|
|
|
Logged
|
|
|
|
Zaphos
Guest
|
|
« Reply #8 on: January 16, 2009, 08:34:59 AM » |
|
Your translation is wrong, Gold Cray -- you should test it as you're making it, heh.
increpare's function squares the sum of two numbers ...
|
|
|
Logged
|
|
|
|
increpare
Guest
|
|
« Reply #9 on: January 16, 2009, 08:37:55 AM » |
|
Correct.
Your turn...
|
|
|
Logged
|
|
|
|
Zaphos
Guest
|
|
« Reply #10 on: January 16, 2009, 09:18:55 AM » |
|
Okay ... I will take a bit to write it, though.
|
|
|
Logged
|
|
|
|
Zaphos
Guest
|
|
« Reply #11 on: January 16, 2009, 11:01:21 AM » |
|
I didn't feel like removing all the letters or whitespace ... hopefully it is still a bit confusing! #include <iostream>
int C(int x, int i);
int Z(int x, int n) { int v = x >> 31; return (((x + v) ^ v) & (~((~0) << n))) ^ v + !!v; }
int D(int i) { return i > 0 ? D(i-1) << 1 : 1; }
int G(int i) { return Z(~(1 << 31), D(i)); }
int B(int x, int i, int q) { return i<1?(q<<i):i + (q << i) + C(x >> (q << i), i-1) - (i>>1); }
int C(int x, int i) { return i<1?G(2):(i>>1) + (!!((~G(i)) & x) << i) + B(x >> (!!((~G(i)) & x) << i), i-1, !!(-(G(i-1)+1) & (x >> (!!((~G(i)) & x) << i)))) - i; }
int F(int h) { return B(h,D(2),!!(-D(16)&h)); }
int main() { std::cout << F(34) << std::endl; return 0; }
|
|
|
Logged
|
|
|
|
|
Zaphos
Guest
|
|
« Reply #13 on: January 17, 2009, 12:48:23 PM » |
|
Yep, your turn now.
|
|
|
Logged
|
|
|
|
J. Kyle Pittman
|
|
« Reply #14 on: January 17, 2009, 11:07:30 PM » |
|
#include <stdio.h> #include <math.h> #define _ main #define __ float #define ___ return #define ____ printf #define _____ fabsf #define c(x) *(char**)(&x) #define f(x) *(float*)(&x) __ e=1e-6f,g=0;_(n,p){___(n>1)?((g=(__)_ (-n)/(__)_(1-n))&&((_____(f(p)-g)>e)?_(n +1,c(g)):____("%f\n",g))):((n<1)?((n>-2) ?(-n):(_(n+1,2)+_(n+2))):_(2,c(g)));}
|
|
|
Logged
|
|
|
|
|