home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG003.ARC
/
JRTPAS-1.LBR
/
GROG102.PAS
next >
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
640b
|
22 lines
Program Hanoi;
var
total : integer;
procedure movetower (height,fromneedle,toneedle,useneedle : integer);
procedure movedisk (takeoff,puton : integer);
begin
writeln(takeoff:2,' > ',puton:2)
end; (* movedisk *)
begin
if height > 0 then
begin
movetower(height-1,fromneedle,useneedle,toneedle);
movedisk(fromneedle,toneedle);
movetower(height-1,useneedle,toneedle,fromneedle)
end;
end;
begin (* main program *)
writeln('How many discs?');writeln;
read (total);
movetower (total,1,3,2)
end.