| changeset 894 | 4d5058706f1b | 
| parent 893 | 908e4f6cdf7c | 
| child 895 | 550676e542d2 | 
| 893:908e4f6cdf7c | 894:4d5058706f1b | 
|---|---|
| 1 // Towers of Hanoi in Fun | |
| 2 | |
| 3 def hanoi(n: Int, a: Int, b: Int, c: Int) : Void = | |
| 4 if n != 0 then { | |
| 5 hanoi(n - 1, a, c, b); | |
| 6 print_int(a); | |
| 7 print_char('-'); print_char('>'); // prints out "->" | |
| 8 print_int(b); | |
| 9 print_char('\n'); | |
| 10 hanoi(n - 1, c, b, a) | |
| 11 } else skip; | |
| 12 | |
| 13 hanoi(4,1,2,3) |