Things I learned :
- Python for backend.
- Exchanging information between back-end and front-end in web app
How I built :
I made a tower() class in python which takes input n during initialisation in it's constructor - which is the number of discs , and there is a method call inside it named hanoi() which will organise the discs from initial pole to final pole using 3rd pole as an auxiliary pole .
There is a count property of that class which get's incremented whenever there is a successful conversion of a disc .
I used flask as the web framework and used its inbuilt jinja templating engine to render a html page and used wtforms to get the parameter 'n' i.e. number of discs as user input .
Finally n is passed to flask and python processes and returns the count property of tower() class and the array of the sequential transformations .
Finally user gives input , adjusts speed (speed is set to default as 500ms) and see the animation in action .
I minified the js and used it inside html to decrease load times .
Challenges I faced :
- The making of the animation without requestAnimationFrame() was a huge challenge . I made everything from scratch and that was very difficult .
- I didn't know anything about html forms and HTTP requests . I learnt flask , forms and templating . It was a challenge , but once the basics were clear it was easy .
Thanks you so much for giving me this platform :)