summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/hanoi/hanoi.tex
blob: fb8ff66d50f3fe12638c4151206568880dab10e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
% Author:  Brian Blackmore <blb8@po.cwru.edu>
% Date:  January 1, 2012
% Version:  20120102
% License:  Public Domain
% Requirements:  Plain TeX

                                %
                               % %
                              %   %
                             %     %
                            % Tower %
                           %  of     %
                          %   Brahma  %
                         % (Plain TeX) %
                        %  by Brian     %
                       %      Blackmore  %
                      %        20120101   %
                     %                     %
                    \nopagenumbers\output{}{}
                   \chardef\_13\catcode%edocta
                  126 \_ \let ^^> \catcode~47 0
                 ~95/_/let_\let~43/__^^k/def ~64
                11 ~81\_ ~86 1 ~119 ~86 ~85 2 ~87
               ~85 ~`/!/_~80\__P/vsize~34 14~83\_+
             S#1{}~`/X13_X\expandafter\divide\hsize
            by3 \multiplyP3 \output{\shipout/vbox to
           0.34PV\hbox to\z@w\vsplit255 to0.34P\hfil%                      A
          \vsplit255 to0.34P\hfil/vbox to0.34Pw\unvbox                    SVU
         Sa 255U\hssWU\ifnum/outputpenalty>-10000\else"                  \font
        \dosupereject\fiW  ~`\>13_^^~\rightline _!\count                \font"%
       /rm=cmr8\rm\baselineskip9pt !2 0 +/AV1 2 3 4 5 6 7              8 9 10 11
      12 13 14 15 VW wU}+\BwVU wUW +\CV{U w}}+/spw\vboxw>V            Move Sb/the
     !2U>w/A:U>V\B:W>w\C:}}\vskip8pt plus4pt }+\f#1 #2f{#1U          +/nf#1 #2fV%W
    #2W +\h#1wX\f#1fW +/T#1VX\nf#1f} +\rh#1w\xdef#1V/TV#1}WU        SwU+\move#1#2{"
   \global\advance!2by1 /edef\twX\hV#1}W/rhw#1W\xdef#2VSwby-1      7W\t\space#2}/spW
  +Q#1#2#3#4w\ifnum#1=1 \moveV#2}w#3U/elseV!0 #1\advance!0by-1    \edef/taV"#7WWVabcd
 /the!0WQw/ta}V#2Ww#4}{#3W/moveV#2UV#3}QV\ta}w#4Ww#3Ww#2U}/fi}Q  V10WV/AUw\C}V/BW \bye
=======================================================================================
If you want the full tower with 15 discs, change this number ten  ^^ to 15 for 713 pgs.

                                 Happy TeXing in 2012!

=======================================================================================