Tower of Hanoi by uru

var s,n:string;procedure h(n,a,b,c:char);begin
if n='0'then return;dec(n);h(n,a,c,b);write(a);s:=s+c;h(n,b,a,c)end;begin
read(n);h(n[1],'A','B','C');write(^j,s)end.

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page