![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Problem with getting multiple solutions from Knight's Tour...Hi guys, I've been working on this for a while and I can't seem to figure out quite what I'm doing wrong here. So far this code successfully finds a knight's tour, but I can't seem to get it to backtrack and display multiple solutions for the problem (the number of solutions is given as user input). I'm not quite sure what direction to go in from here, most of my attempts haven't worked too well ;-) Thanks in advance for your help!
Here's the function code (I'm 99% sure the problem lies within this function, as the other things seem to work fine): CPP / C++ / C Code:
|
|||
|
#2
|
||||
|
||||
Re: Problem with getting multiple solutions from Knight's Tour...Can you set a break point, to step through this function to see what's happening with either the logic and/or variable values? Or maybe add some prints at expected points. It's not fully clear what else may be happening in the program.
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
|||
|
|||
Re: Problem with getting multiple solutions from Knight's Tour...Quote:
At each step: when you find a solution from that position you don't look for any more. Don't you, somehow, have to test the other move directions from this position before returning? Otherwise how could you detect multiple solutions from any given position? Quote:
Regards, Dave |
|
#4
|
|||
|
|||
Re: Problem with getting multiple solutions from Knight's Tour...Thanks for the responses, guys. I got it figured out last night after a bit more walking through the code...you're right on, dave. I was returning too quickly, and not giving the recursive function time to finish going through the other alternatives (because the function would return after finding just one solution). Thanks!
|
Recent GIDBlog
Install Adobe Flash - Without Administrator Rights by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Knight's Tour - now with heuristics | earachefl | C++ Forum | 0 | 09-Apr-2006 10:19 |
| Knights Tour - Reloaded . | kobi_hikri | C Programming Language | 12 | 03-Oct-2005 12:15 |
| Linker errors with multiple file progam | nkhambal | C Programming Language | 2 | 24-Apr-2005 02:37 |
| knight tour (chess program) | kai85 | C++ Forum | 10 | 25-Mar-2005 06:12 |
| Another FX 5600 problem (but with details that might shed light on this) | BobDaDuck | Computer Hardware Forum | 2 | 16-Apr-2004 07:53 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The