Annotation of 43BSDTahoe/new/B/ex/hanoi/'HANOI, revision 1.1

1.1     ! root        1: HOW'TO HANOI n:
        !             2:        INITIALISE
        !             3:        FOR i IN {1..(2**n)-1}:
        !             4:                SELECT'PROCESS
        !             5:                WRITE 'Move piece', piece, 'from', from, 'to', to/
        !             6:                RE'SCHEDULE
        !             7: INITIALISE:
        !             8:        PUT {} IN process
        !             9:        FOR i IN {1..n}:
        !            10:                INSERT 2**(i-1), i, 1, (-1)**(i+n), 2**i IN process
        !            11: SELECT'PROCESS:
        !            12:        PUT min process IN time, piece, from, direction, wait
        !            13:        REMOVE min process FROM process
        !            14: RE'SCHEDULE:
        !            15:        INSERT time+wait, piece, to, direction, wait IN process
        !            16: to:
        !            17:        RETURN ((from+direction-1) mod 3) + 1

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.