Thread View: fj.lang.pascal
2 messages
2 total messages
Started by Tsutomu YASUI
Mon, 03 Nov 1997 00:00
Towers of Hanoi
Author: Tsutomu YASUI
Date: Mon, 03 Nov 1997 00:00
Date: Mon, 03 Nov 1997 00:00
3 lines
522 bytes
522 bytes
$B%O%N%$$NEc$r3X9;!J%^%s%A%'%9%?!<9)2J!K$G(BPASCAL$B$G=q$+$J$/$F$O$$$1$^$;$s!#(B $BJ,$+$kJ}O"Mm$/$@$5$$!#(B
Re: Towers of Hanoi
Author: Masahiro Hamada
Date: Tue, 04 Nov 1997 00:00
Date: Tue, 04 Nov 1997 00:00
21 lines
962 bytes
962 bytes
$B0J2<$,:F5"K!$NNc$H$7$FM-L>$J%O%N%$$NEc$N%W%m%0%i%`$G$9!#(J
$B$3$l$r(J Hanoi(0, 'a', 'b', 'c') $B$H$7$F5/F0$9$l$P(JOK$B$G$9!#(JN$B$O1_HW(J
$B$N?t$rI=$7$F$$$^$9!#(J
procedure Hanoi(Depth: Integer; x, y, tmp: Char);
begin
if Depth < N then
begin
Hanoi(Depth + 1, x, tmp, y);
WriteLn(N - Depth, '$BHVL\$NHD$r(J ', x, '$B$+$i(J', y, '$B$X0\F0(J');
Hanoi(Depth + 1, tmp, y, x);
end;
end;
$B:F5"$r;H$o$J$$J}K!$b$"$j$^$9!#(J
--
$B9-EgBg3X(J $B650i3XIt(J
$BIMED(J $B>;9((J hamada@hiroshima-cdas.or.jp
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads