8 Ekim 2008 Çarşamba

python tower of hanoi


"Tower Of Hanoi" is a mathematical puzzle game. there are lots of python examples around but i couldn't find out one with a good UI.

As honoi solving depends on a recrusive function, it was hard to run UI and solve hanoi at same time. Pre-solving and running UI is seemed to be a solution but in big numbers of disks i would have to wait quite long time for solving. So i used python threading module and created one more thread for hanoi solver. It looks like this:

place x disk

place y disk
keeps going deeper...
wait for ui
y disk placed

place z disk
keeps going deeper...
wait for ui
zdisk placed

wait for ui
x disk placed


You need to have pygame installed to run code.


download hanoi.py

2 yorum:

Emre ÖZER dedi ki...
Bu yorum yazar tarafından silindi.
Emre ÖZER dedi ki...

gel duşta ağlıyalım..