View Single Post
Old Mar 1st, 2008, 2:04 PM   #9
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,835
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Re: Conway's Game Of Life - Programming Challenge

I just thought I'd post something I submitted to an Obfuscated Code contest, since it's related to the above few posts.

Note the "glider" embedded in the center of the code.

C Syntax (Toggle Plain Text)
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #define v '='
  5. #define i '='+'='
  6. #define w while
  7. #define _() system("cls")
  8. int c[0X763]={0},cc[0X763]={0};int cccc,ccccc;ccc
  9. (){for(cccc=1;cccc<0X763;cccc++){ccccc=c[cccc%i*(
  10. cccc/v)-'>']+c[cccc%i*(cccc/v)-v]+c[cccc%v-'<'+v*
  11. (cccc/v)]+c[cccc%v-1+ v*(cccc/v)]+c[cccc%v+1
  12. +v* (cccc/v)]+c[cccc% v+'<'+v*(cccc/v)]+ c [
  13. cccc%i*(cccc/v)+v]+ c [cccc%i*(cccc/v)+'>'];
  14. cc[cccc%i*(cccc/v)]=c[cccc%i*(cccc/v)]&&ccccc<2?0
  15. :c[cccc%i*(cccc/v)]&&ccccc>3 ?0:!c[cccc%i* (
  16. cccc/v)]&&ccccc==3?1:c[cccc% i*(cccc/v)] ;}
  17. memcpy(c,cc,sizeof(c));for ( cccc=1 ; cccc <
  18. 0X763;cccc++){putchar(c[cccc%i*(cccc/v)]?'#':' ')
  19. ;ccccc=(!(cccc % v ))?putchar(10):
  20. 0;}sleep(0X190 ) ; _();}main( ) {;
  21. ;{}; c[0X3A2]= c [ 0X3A3]=c[0X3A4]
  22. =c[0X3A7]=c[0X3A8]=c[0X3E2]=c[0X421]=1;w(c)ccc();
  23. char __[]= "Conway's Game Of Life" ;}

Last edited by Sane; Mar 1st, 2008 at 2:28 PM.
Sane is online now   Reply With Quote