I'm new to recursion and object oriented programming, but we have been assigned the knight's tour problem. This is where the knight's piece has to travel to every space on a chess board and land on each spot only once. I pretty much have my program done, except i'm having a small problem. My program runs fine, but when the board prints out, some of the spaces have the same "move" number in them. I can't figure out why this is happening. I'm thinking there may be a small problem in my recursion but i'm not really sure. I attached my code to the post(atleast i think i did). If anyone would take the time to go over it, I would greatly appreciate it. Thanks in advance for any help you can give.
blackdove 0
Light Poster
Recommended Answers
Jump to PostAfter some step-into's, I see your program backtracks well, but the "dead-ends" are not removed. Though it can move forward, the previous cells are not cleared, so it show duplicated numbers in the board.
Let's say the algorithm is ok, but the problem is C++ and the way you …
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.