Task

Solve the   Towers of Hanoi   problem with recursion.




move = proc (n, from, via, to: int)
    po: stream := stream$primary_output()
    if n > 0 then
        move(n-1, from, to, via)
        stream$putl(po, "Move disk from pole "
                     || int$unparse(from)
                     || " to pole "
                     || int$unparse(to))
        move(n-1, via, from, to)
    end
end move
 
start_up = proc ()
    move(4, 1, 2, 3)
end start_up