Towers of Hanoi: Difference between revisions
Content deleted Content added
Added TeX |
m Moved from TeX to PlainTeX |
||
Line 2,038:
end tower;</lang>
<lang TeX>\newcount\hanoidepth▼
\def\hanoi#1{%▼
\hanoidepth = #1▼
\move abc▼
}%▼
\def\move#1#2#3{%▼
\advance \hanoidepth by -1▼
\ifnum \hanoidepth > 0▼
\move #1#3#2▼
\fi▼
Move the upper disk from pole #1 to pole #3.\par▼
\ifnum \hanoidepth > 0▼
\move#2#1#3▼
\fi▼
\advance \hanoidepth by 1▼
}▼
\hanoi{5}▼
\end</lang>▼
=={{header|PostScript}}==
Line 2,826 ⟶ 2,848:
14: move from A to C
15: move from B to C</pre>
▲=={{Header|TeX}}==
▲<lang TeX>\newcount\hanoidepth
▲\def\hanoi#1{%
▲ \hanoidepth = #1
▲ \move abc
▲}%
▲\def\move#1#2#3{%
▲ \advance \hanoidepth by -1
▲ \ifnum \hanoidepth > 0
▲ \move #1#3#2
▲ \fi
▲ Move the upper disk from pole #1 to pole #3.\par
▲ \ifnum \hanoidepth > 0
▲ \move#2#1#3
▲ \fi
▲ \advance \hanoidepth by 1
▲}
▲\hanoi{5}
▲\end</lang>
=={{header|TI-83 BASIC}}==
|