Live data from Hacker News

The world's smallest self-replicating program

ioccc.org

11–20 of 65 posts

Re: The world's smallest self-replicating program

#12

The Makefile is the most interesting part: http://www.ioccc.org/1994/Makefile smr: smr.c @${RM} -rf smr ${CP} smr.c smr ${CHMOD} +x smr Apparently, an empty file marked as executable will execute!

Because it's being interpreted as a shell script, I assume.

Re: The world's smallest self-replicating program

#14
post #12

The Makefile is the most interesting part: http://www.ioccc.org/1994/Makefile smr: smr.c @${RM} -rf smr ${CP} smr.c smr ${CHMOD} +x smr Apparently, an empty file marked as executable will execute!

Because it's being interpreted as a shell script, I assume.

Without a hashbang it's actually interpreted as machine code, it just doesn't have any machine instructions.

Re: The world's smallest self-replicating program

#15
There is PDP-11 command (one word, 16 bits) which makes a copy of itself into a previous word (with address, in bytes, less by two) and passes the control to the new copy. Octal 103737... or something like that.

Doesn't require make :) or cp and is pretty active - fills up all the memory space below the starting point in no time.

Re: The world's smallest self-replicating program

#19
post #12

Earlier quoted context omitted.

Because it's being interpreted as a shell script, I assume.

Without a hashbang it's actually interpreted as machine code, it just doesn't have any machine instructions.

Interesting that this works at all. Perhaps it's special-cased?

Re: The world's smallest self-replicating program

#20

Isn't this a quine, rather than a self-replicating program? A quine produces the source, and a self-replicating program should produce an executable - no? This seems to be a fallacy of equivocation.

quines are a subset of self-replicating programs.
Post reply on HN