Task

Solve the   Towers of Hanoi   problem with recursion.




 
/** Set up the recursive call for n disks */
hanoi[n] := hanoi[n, 1, 3, 2]
 
/** The recursive call. */
hanoi[n, source, target, aux] :=
{
   if n > 0
   {                       
      hanoi[n-1, source, aux, target]                          
      println["Move from $source to $target"]                                                                     
      hanoi[n-1, aux, target, source]
   }
}
 
hanoi[7]
 