Simula
The Towers of Hanoi implemented in Simula.
%
% The Towers Of Hanoi
% Simula
% Copyright (C) 1998 Amit Singh. All Rights Reserved.
% http://hanoi.kernelthread.com
%
% Tested under cim 2.8
% In the call to `dohanoi' later, the number of disks
% has been hardcoded as 3. This may be changed.
begin
procedure dohanoi(n, t, f, u); integer n, t, f, u;
if n > 0 then
begin
dohanoi(n-1, u, f, t);
OutText("move ");
OutInt(f,0);
OutText(" --> ");
OutInt(t,0);
OutImage;
dohanoi(n-1, t, u, f);
end;
dohanoi(3, 3, 1, 2);
end;