From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/plain/contrib/hanoi/hanoi.tex | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 macros/plain/contrib/hanoi/hanoi.tex (limited to 'macros/plain/contrib/hanoi') diff --git a/macros/plain/contrib/hanoi/hanoi.tex b/macros/plain/contrib/hanoi/hanoi.tex new file mode 100644 index 0000000000..fb8ff66d50 --- /dev/null +++ b/macros/plain/contrib/hanoi/hanoi.tex @@ -0,0 +1,43 @@ +% Author: Brian Blackmore +% 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! + +======================================================================================= -- cgit v1.2.3