[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Apr 19 22:03:35 1993 
Subject:Re: Self-printing program [quiz] 
From:Aaron Sloman 
Volume-ID:930419.02 

> Date: Mon, 19 Apr 1993 16:23:47 GMT
> Organization: Hewlett-Packard Laboratories, Bristol, UK.
>
> Here's another vile challenge, this time from Adrian Howard .... I thought
> readers may enjoy this one:
>
> Adrian writes:
> > PS For another little Pop-11 puzzle, try the smallest self-printing
> > Pop-11 program. In some moments of idleness I got one that printed
> > itself in 65 characters. Not the most transparent code in the world I
> > admit. Assumptions:
> >       i) ASCII
> >      ii) class_print routines havn't been mucked with
> >     iii) You can skip the trailing ";" & newline character
>
> Naturally enough, the empty program is disallowed.  We are interested
> in the smallest program whose length is at least one byte.

How's this:

    % pop11
    Sussex POPLOG (Version 14.2 Wed Feb  3 12:46:18 GMT 1993)

    Setpop
    : sysobey('ls s*');
    sysobey('ls s*');
    :

17 characters, typed in line 5, including the ";", and excluding the
newline.

I happened to have one, and only one, suitably named file starting
with 's' in the current directory.

I know, it's cheating....
Aaron
---
-- 
Aaron Sloman,
School of Computer Science, The University of Birmingham, B15 2TT, England
EMAIL   A.Sloman@cs.bham.ac.uk  OR A.Sloman@bham.ac.uk
Phone: +44-(0)21-414-3711       Fax:   +44-(0)21-414-4281