Live data from Hacker News

The world's smallest self-replicating program

ioccc.org

21–30 of 65 posts

Re: The world's smallest self-replicating program

#21
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.

No, without a shebang it is interpreted as a shell script.

Re: The world's smallest self-replicating program

#22
post #8
post #5

Earlier quoted context omitted.

Forcing the creation of a new contest rule is a tradition in the IOCCC.

Meh. Empty program doesn't replicate itself. It's similar to recent rule-nitpick discussion about selling for 0$. Selling for 0$ isn't selling and nothing isn't replicating itself. Definition of replicate is: to repeat or copy (something) exactly Empty program doesn't copy or repeat anything. Entry rejected. EDIT: It's not reddit, downvotes doesn't go here for disagreeing. The problem is posed in natural language and…

The empty set is a subset of the empty set.

Re: The world's smallest self-replicating program

#23

phiX174 virus - one of the world's smallest self-replicating programs :-) http://www.ncbi.nlm.nih.gov/nuccore/NC_001422.1 Enterobacteria phage phiX174 sensu lato, complete genome 5386 bp ss-DNA

Hehe funny that you mention phiX174 in the context of programming, that virus is amazing... Part of the reason phiX174 is so small is that it is "compressed" by having overlapping genes; in one area, three genes overlap in the same place! This is possible because there are 6 valid reading frames (direction and start point) for reading DNA: {forward or backward} x {address % 3 == 0, 1, or 2}.

In college I actually got to take part in refactoring that virus' genome into a decompressed version with no gene overlaps. And it worked! The decompressed version is still a functioning phage, and since there are no longer gene overlaps, future genetic engineers will have a much easier time modifying the phage as they see fit.

http://www.sciencedirect.com/science/article/pii/S0042682212...

Re: The world's smallest self-replicating program

#24
post #5
post #2

lol not quite in the spirit of the challenge.

Forcing the creation of a new contest rule is a tradition in the IOCCC.

That tradition goes back a long, long way. When Plato defined Man as "A featherless biped," someone showed him a plucked chicken.

A great tradition.

Re: The world's smallest self-replicating program

#25
I hang out on /r/dailyprogrammer sometimes - they had a challenge about these types of programs the other day and called them "quines." Check through some of these if you're interested, a few are 2 characters long (not sure how many bytes that is): http://www.reddit.com/r/dailyprogrammer/comments/2n11w8/2014...

Re: The world's smallest self-replicating program

#26
post #24
post #5

Earlier quoted context omitted.

Forcing the creation of a new contest rule is a tradition in the IOCCC.

That tradition goes back a long, long way. When Plato defined Man as "A featherless biped," someone showed him a plucked chicken. A great tradition.

Exactly, and that someone is the humble "Diogenes of Sinope"

Re: The world's smallest self-replicating program

#27
post #11
post #4

Is the copyright notice supposed to apply to the empty program?

Not sure about the copyright, but I wouldn't be surprised if someone patented it in the US.

Actually, there was a story about somebody selling 0-byte executable for DOS allowing you to resume programs because of some peculiarity.

Re: The world's smallest self-replicating program

#28
post #21

Earlier quoted context omitted.

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

No, without a shebang it is interpreted as a shell script.

Correct. A file will only be considered a binary executable if it has a proper header (ELF, Mach-O, etc) The default if no header and no shebang is to treat it like a shell script.

In fact, an empty executable file has been used to implement /bin/true on some old systems. Why take the added cost of a disk seek when just the information in the inode will do?

Re: The world's smallest self-replicating program

#30
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.

No file on common unix platforms is interpreted directly as machine code. Machine code executables have headers which contain information on the environment needed, memory mappings, program entry points etc. Binary executables are not just immediately jumped into, they must be opened by a loader which will parse these headers and do the required work before continuing execution in the program itself.

A zero-length binary fed into either ld.so (a.out loader) or ld-linux.so (elf loader) will not produce a zero-length output, but a parsing error.

Post reply on HN