<!-- The Towers Of Hanoi                                -->
<!-- VBScript Implementation                            -->
<!-- Copyright (C) 2000 Amit Singh. All Rights Reserved -->
<!-- http://hanoi.kernelthread.com                      -->
<!--                                                    -->

<!-- Save this file as hanoi.htm and view it in IE      -->

<html>
<head>
    <title>The Towers Of Hanoi</title>
    <script type="text/vbscript">
    <!--

    Sub Hanoi(n)
        Call DoHanoi("1", "2", "3", n)
    End Sub

    Sub DoHanoi(f, u, t, n)
    If n = 1 Then
        Document.Writeln("move" + f + " to " + t + "<br>")
    Else
        DoHanoi f, t, u, n-1
        DoHanoi f, u, t, 1
        DoHanoi u, f, t, n-1
    End If
    End Sub

    Sub HButton_OnClick()
        Dim ndisks
        ndisks = CLng(Document.Forms(0).txtBox1.value)
        Call DoHanoi("1", "2", "3", ndisks)
    End Sub
    -->
    </script>
</head>
<body>
    <form action=""> 
        Number of disks:
        <input type="text" name="txtBox1" size="5" value="0"><p>
        <input type="button" name="HButton" value="Enter"></p>
    </form> 
</body>
</html>
