Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!paperboy!osf!flowers From: flowers@osf.osf.org (Ken Flowers) Newsgroups: comp.text Subject: A towers troff hack Message-ID: <19661@paperboy.OSF.ORG> Date: 6 Mar 91 16:05:59 GMT Sender: news@OSF.ORG Lines: 295 With all the recent talk of Towers of Hanoi programs in editors, I thought I would submit a little hack I wrote. This is an interactive TOH hack in troff. Save the first file as tower.main Save the second file as tower.loop execute it by entering - nroff -q tower.main Standard disclaimers apply, Ken Flowers +++++++++++++++++++CUT HERE - tower.main++++++++++++++ ...\" ...\" THE TOWERS OF TROFF ...\" ...\" A troff hack by Ken Flowers ...\" Main file ...\" ...\" Invoke this game with the following command: ...\" ...\" nroff -q tower.main ...\" .ds 0 " | .ds 1 " - .ds 2 " --- .ds 3 " ----- .ds 4 " ------- .ds 5 " --------- .ds 6 " ----------- .ds 7 " ------------- .ds B "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX .ds N "X 1 2 3 X .nr 11 7 .nr 21 6 .nr 31 5 .nr 41 4 .nr 51 3 .nr 61 2 .nr 71 1 .nr 12 0 .nr 22 0 .nr 32 0 .nr 42 0 .nr 52 0 .nr 62 0 .nr 72 0 .nr 13 0 .nr 23 0 .nr 33 0 .nr 43 0 .nr 53 0 .nr 63 0 .nr 73 0 .de 12 .d1 .i2 .. .de 13 .d1 .i3 .. .de 23 .d2 .i3 .. .de 21 .d2 .i1 .. .de 32 .d3 .i2 .. .de 31 .d3 .i1 .. .de d1 .nr mv 0 .if '\\n(mv'0' \{ .nr mv \\n(71 .nr 71 0\} .if '\\n(mv'0' \{ .nr mv \\n(61 .nr 61 0\} .if '\\n(mv'0' \{ .nr mv \\n(51 .nr 51 0\} .if '\\n(mv'0' \{ .nr mv \\n(41 .nr 41 0\} .if '\\n(mv'0' \{ .nr mv \\n(31 .nr 31 0\} .if '\\n(mv'0' \{ .nr mv \\n(21 .nr 21 0\} .if '\\n(mv'0' \{ .nr mv \\n(11 .nr 11 0\} .if '\\n(mv'0' bad move .. .de d2 .nr mv 0 .if '\\n(mv'0' \{ .nr mv \\n(72 .nr 72 0\} .if '\\n(mv'0' \{ .nr mv \\n(62 .nr 62 0\} .if '\\n(mv'0' \{ .nr mv \\n(52 .nr 52 0\} .if '\\n(mv'0' \{ .nr mv \\n(42 .nr 42 0\} .if '\\n(mv'0' \{ .nr mv \\n(32 .nr 32 0\} .if '\\n(mv'0' \{ .nr mv \\n(22 .nr 22 0\} .if '\\n(mv'0' \{ .nr mv \\n(12 .nr 12 0\} .if '\\n(mv'0' bad move .. .de d3 .nr mv 0 .if '\\n(mv'0' \{ .nr mv \\n(73 .nr 73 0\} .if '\\n(mv'0' \{ .nr mv \\n(63 .nr 63 0\} .if '\\n(mv'0' \{ .nr mv \\n(53 .nr 53 0\} .if '\\n(mv'0' \{ .nr mv \\n(43 .nr 43 0\} .if '\\n(mv'0' \{ .nr mv \\n(33 .nr 33 0\} .if '\\n(mv'0' \{ .nr mv \\n(23 .nr 23 0\} .if '\\n(mv'0' \{ .nr mv \\n(13 .nr 13 0\} .if '\\n(mv'0' bad move .. .de i1 .if '\\n(11'0' \{ .nr 11 \\n(mv .nr mv 0\} .if '\\n(21'0' \{ .nr 21 \\n(mv .nr mv 0\} .if '\\n(31'0' \{ .nr 31 \\n(mv .nr mv 0\} .if '\\n(41'0' \{ .nr 41 \\n(mv .nr mv 0\} .if '\\n(51'0' \{ .nr 51 \\n(mv .nr mv 0\} .if '\\n(61'0' \{ .nr 61 \\n(mv .nr mv 0\} .if '\\n(71'0' \{ .nr 71 \\n(mv .nr mv 0\} .if !'\\n(mv'0' bad move .. .de i2 .if '\\n(12'0' \{ .nr 12 \\n(mv .nr mv 0\} .if '\\n(22'0' \{ .nr 22 \\n(mv .nr mv 0\} .if '\\n(32'0' \{ .nr 32 \\n(mv .nr mv 0\} .if '\\n(42'0' \{ .nr 42 \\n(mv .nr mv 0\} .if '\\n(52'0' \{ .nr 52 \\n(mv .nr mv 0\} .if '\\n(62'0' \{ .nr 62 \\n(mv .nr mv 0\} .if '\\n(72'0' \{ .nr 72 \\n(mv .nr mv 0\} .if !'\\n(mv'0' bad move .. .de i3 .if '\\n(13'0' \{ .nr 13 \\n(mv .nr mv 0\} .if '\\n(23'0' \{ .nr 23 \\n(mv .nr mv 0\} .if '\\n(33'0' \{ .nr 33 \\n(mv .nr mv 0\} .if '\\n(43'0' \{ .nr 43 \\n(mv .nr mv 0\} .if '\\n(53'0' \{ .nr 53 \\n(mv .nr mv 0\} .if '\\n(63'0' \{ .nr 63 \\n(mv .nr mv 0\} .if '\\n(73'0' \{ .nr 73 \\n(mv .nr mv 0\} .if !'\\n(mv'0' bad move .. \& .sp 5 \*\n(71\*\n(72\*\n(73 .br \*\n(61\*\n(62\*\n(63 .br \*\n(51\*\n(52\*\n(53 .br \*\n(41\*\n(42\*\n(43 .br \*\n(31\*\n(32\*\n(33 .br \*\n(21\*\n(22\*\n(23 .br \*\n(11\*\n(12\*\n(13 .br \*B .br \*N .br \*B .br .fl .nx tower.loop +++++++++++++++++++CUT HERE - tower.loop++++++++++++++ ...\" ...\" THE TOWERS OF TROFF ...\" ...\" A troff hack by Ken Flowers ...\" Loop file ...\" .sp enter move (.12, .13, .21, .23, .31, .32, .ex) .br include the "." .br type two returns when finished .sp .br .fl .rd .fl \& .sp 5 \*\n(71\*\n(72\*\n(73 .br \*\n(61\*\n(62\*\n(63 .br \*\n(51\*\n(52\*\n(53 .br \*\n(41\*\n(42\*\n(43 .br \*\n(31\*\n(32\*\n(33 .br \*\n(21\*\n(22\*\n(23 .br \*\n(11\*\n(12\*\n(13 .br \*B .br \*N .br \*B .br .fl .nx tower.loop