towers-of-hanoi/README.md

892 B

Towers of Hanoi

Alt text

Small repo with two scripts around the popular Towers of Hanoi puzzle. I decided to do this after having lunch with some friends which were a few courses ahead of me in CS, and they talked about this puzzle, and I had never thought of solving it with a computer, and I thought it would be a fun and simple CP challenge for myself, so I sat in front of the computer that(this) evening and this is what came out.

  • game.py: A simple implementation of the game, which also includes a solver which I created when trying to solve the problem without ever having seen the solution (but it finds the optimal solution nonetheless)

  • animation.py: Creates/shows an animation of the optimal solution (in 2^n-1 moves with n as number of disks). Execute it with python3 animation.py -h to see how to use it. It generated the gif on top of this file