### Recursive backtracking question

So, in short I'm working on a knight's tour program. If you don't know what that is, the knight gets put on the chess board and you have to move it to every spot on the board exactly once. I'm using a recursive function but am having trouble getting my backtracking to work. I can get to 22 steps in a 5x5 board but the program won't back up and try a different path. I'm posting just the recursive part of my code (sorry it's a little long) Any insight would be extremely helpful. Thanks a lot!

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101`` ``````bool findPath ( int board[][boardSize + 4], int &currRow, int &currCol, int &currMove,int boardSize ) { int i, j; bool foundSpot; board[currRow][currCol] = currMove; if ( currMove == boardSize * boardSize ) return true; for ( i = 0; i < boardSize + 4; i++ ) { for ( j = 0; j < boardSize + 4; j++ ) cout << setw (3) << board[i][j]; cout<
Topic archived. No new replies allowed.