This is one version of
http://www.gtoal.com/languages/algol60/TESTS/hanoi.a60.html from your personal cache.
The page may have changed since that time. Click here for the current page.
Since this page is stored on your computer, publicly linking to this page will not work.
Google may not be affiliated with the authors of this page nor responsible for its content. This page may be protected by copyright.
|
|
begin;
comment
The Towers Of Hanoi
Algol-60
Copyright (C) 1999 Amit Singh. All Rights Reserved.
http://hanoi.kernelthread.com
;
procedure MOVEDISK(N, F, T);
integer N;
integer F;
integer T;
begin;
OUTSTRING(1, "MOVE ");
OUTINTEGER(1, F);
OUTSTRING(1, " --> ");
OUTINTEGER(1, T);
OUTSTRING(1, "\N");
end ;
procedure DOHANOI(N, F, T, U);
integer N;
integer F;
integer T;
integer U;
begin;
if N < 2 then MOVEDISK(1, F, T) else begin;
DOHANOI(N - 1, F, U, T);
MOVEDISK(1, F, T);
DOHANOI(N - 1, U, T, F);
end ;
end ;
DOHANOI(3, 1, 3, 2);
end ;