From: Robin Rytich on 9 Mar 2010 20:57 Hi all I'm having some troubles with writing Knight's tour (http://en.wikipedia.org/wiki/Knight%27s_tour) solution in Python 3. I'm using Warnsdorff's algorithm (http://en.wikipedia.org/wiki/Knight% 27s_tour#Algorithm) and I'm wondering why it doesn't work with boards of certain sizes. I've written a solution and I like it but it does not work correctly for 15x15, 26x26, 27x27 and 32x32 boards (don't know why; checked from 5x5 to 40x40). So I'd be really glad if you tell me whether I am too stupid for Python or for Discrete Math? In other words, did I implemented Warnsdorff's algorithm in Python 3 correctly or maybe all my troubles are because I haven't read tutorial with enough patience? P.S. Warnsdorff's algorithm says that it's not really important which square to choose between those which have equal amount of ways out. In spite of that I tried to changed my program and added '=' to condition at line 78. Results were quite surprising: now it works for 5x5, 6x6, ... 34x34 but not for 35x35!

Pages: 1 Prev: Can't build hashlib Next: Knight's tour Warndorff's algorithm problem 