@c+
module test15_1 -- hanoiTowers
 -- test of simple recursion with local variables and parallel assign
private
 integer From, To, Using, count;
 proc hanoi() 
        integer holdCount, F,T,U;
        begin
		 holdCount := count;
		 F, T, U := From, To, Using;
		 if	holdCount = 0 -> skip;	 	
		 []	holdCount > 0 -> 
					count := holdCount -1;
					From, To, Using := F, U, T;
					hanoi();	--first	recursion
					write 'move from ',F,'	to ',T ;
					count := holdCount-1;
					From, To, Using := U, T, F;
					hanoi();	--second recursion
        fi;
        end;
	

 begin
read count; -- use a small value -- say 4
From, To, Using := 1, 2, 3;
hanoi();
end.
