hi!
This is my first contribution here. Since i’m occupied with coding most of the time, be prepared for some nerdie/tech stuff from my side. Like this for instance;
Some people have weird hobbies. One such a hoddy is ‘Code Obfuscation’. This is the art of writing code that’s virtually impossible for anyone (human) to read, but that still compiles into a valid executable.
There’s serious contests organised around this idea, but i came accross this next example while researching ‘maze algorithms’ (another weird hobby…). It isn’t really Obfuscated Code, but it comes from the same kind of sick mind.
Take this piece of C code:
char*M,A,Z,E=40,J[40],T[40];main(C){for(*J=A=scanf(M="%d",&C);
-- E; J[ E] =T
[E ]= E) printf("._"); for(;(A-=Z=!Z) || (printf("\n|"
) , A = 39 ,C --
) ; Z || printf (M ))M[Z]=Z[A-(E =A[J-Z])&&!C
& A == T[ A]
|6<<27<rand()||!C&!Z?J[T[E]=T[A]]=E,J[T[A]=A-Z]=A,"_.":" |"];}
Not only will this compile fine, also the source itsself contains the word “MAZE” (twice actually).
When you paste this in a textfile (maze.c), compile gcc -o maze maze.c and run it ./maze the output will look something like this: (note: the program waits for a number to be entered before it does anything)
._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
| | |_. ._|_._. ._| . ._._._._|_._. | | ._. ._|_. ._._|_. | | | |_. ._. ._. | |
| ._._|_. ._. ._|_._|_. . |_._. ._. . |_. |_._._._. | . | | ._. | |_. |_._| ._|
|_._. |_._| |_. . | ._._|_| ._| ._|_|_| | | | | |_._|_|_. |_. |_._._._._._|_._|
|_. |_. |_._._._|_. ._. ._._._|_. ._._| |_._. ._| |_. | |_. |_. ._. ._| . |_. |
|_. | ._. . | | . ._. | . . | |_._._. . ._| |_._. | ._|_._. | | ._|_. |_|_. . |
| | |_._|_|_._. |_._|_|_|_|_| |_. ._|_| . ._._. |_._._. . ._| |_|_. ._._| ._|_|
|_. . . . |_. | | | | ._|_. ._|_. ._| ._|_|_._. ._| | |_| ._._| ._|_. |_. . . |
| |_| | |_._|_. | ._|_. | |_._._. | |_|_. | | | . ._| |_._. |_. ._. ._. ._|_| |
| | |_| . | . . . ._._._._. ._. ._| . |_._. | ._|_| |_. | |_. | ._| ._| | |_._|
| ._. | | ._|_| | |_. ._. |_._|_._| |_. ._|_._._. | |_._._._. |_. | | |_| |_. |
|_._| . | . | ._| ._|_. |_._._._._. ._| ._. ._._._. ._. | . | |_._|_._._._._. |
|_. |_| |_|_| ._|_._._. | . . . ._._|_._| | ._| | |_| ._|_| . . | |_._._. | | |
|_._. . ._._|_|_._._._._| | |_|_._| . | ._._._._. ._|_. | |_|_| |_._. ._. ._._|
|_. . | |_. |_. | | | |_._| ._. ._._|_|_. ._|_._. . ._| |_. | | ._. . | . ._. |
|_. |_| . ._. . . | |_._. | |_._|_. ._._. |_._. ._|_| ._._._. ._. |_|_|_|_| |_|
|_._|_._| ._|_| |_| | |_._._._. |_._. | ._._| | ._|_._|_._. . ._|_| ._. | ._._|
| | |_._. ._. |_. ._| . . | |_._. | | |_|_. ._._. . | ._. |_| . . ._| . | ._._|
| . ._| . ._| ._| | |_|_|_._. | | . |_|_._._. | |_|_._| |_. |_| | | | |_| |_. |
| |_| |_| |_. | . ._. ._. ._|_. ._| . |_. ._._. ._. ._| |_. ._| |_._| . | |_. |
|_._._._._._|_|_|_._|_._|_._._|_._|_|_._|_._._|_._|_|_._._._._|_._._|_|_._._._|
source: http://homepages.cwi.nl/~tromp/maze.html