Welcome to weblogs.com.pk Sign in | Join | Help

fakeGeek

Geek-ol-o-gy (n). See Geekology
Self-Reproducing programs....

Self reproducing programs are those that take no input, and on compiling they output the sourcecode. What do you think :) Winner is the one who writes a program that can deceive the compiler producing no warnings and no program language violations.  Program should be the shortest possible program

You can find a lot of examples here. Following is an example of a Self-producing program in C( Found it on aforesaid URL, i don't take any responcibility as i have not compiled and tested the code, it is just to give you an idea)

#include<stdio.h>
main(){char*c="\\\"#include<stdio.h>%cmain(){char*c=%c%c%c%.102s%cn%c
;printf(c+2,c[102],c[1],*c,*c,c,*c,c[1]);exit(0);}\n";printf(c+2,c[10
2],c[1],*c,*c,c,*c,c[1]);exit(0);}

Self-Reproducing programs written in practise for fun and academic purposes are not actually self-producing. Think, ponder over it..See the above example with meticulous care and you might be able to guess my point :)

I hope there are lot of .NET and java people around; i thinnk you guys can have a small competition as to who will produce the best Self-Producing program..No flames :)

Published Sunday, May 15, 2005 4:03 AM by fakeGeek

Comments

No Comments
Anonymous comments are disabled
 
Powered by Community Server (Personal Edition), by Telligent Systems