Skip to content

Commit 6e0baea

Browse files
authored
Create Hanoi.vbs
Added a recursive script for displaying moves for a Tower of Hanoi puzzle.
1 parent c9af6c2 commit 6e0baea

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: puzzles/Tower_Of_Hanoi/VBScript/Hanoi.vbs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Sub Hanoi(n, source, destination, helper)
2+
If n < 1 Then Exit Sub
3+
Hanoi n - 1, source, helper, destination
4+
WScript.Echo "Move disk #" & n & " from " & source & " rod to " & destination & " rod."
5+
Hanoi n - 1, helper, destination, source
6+
End Sub
7+
8+
Hanoi 4, "left", "middle", "right"

0 commit comments

Comments
 (0)