Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having issues writing the move function as described below in the knights t

ID: 3734396 • Letter: I

Question

I am having issues writing the move function as described below in the knights tour program, any advice would be appreciated.

#ifndef KNIGHTS_TOUR_H
#define KNIGHTS_TOUR_H

#include <vector>
using namespace std;

class KnightsTour {

public:
   KnightsTour(int board_size);

   int generate(int row, int col);

private:
   void move(int row, int col, int& m, int& num_tours);
        void get_moves(int row, int col, int row_moves[], int col_moves[], int& num_moves);
   void print();

   int board_size;
   vector<vector<int> > board;

};

#endif

move is a recursive backtracking function that will print all solutions to the
knight’s tour problem on a chessboard starting from positions row, col. The
total number of tours found is returned in the reference variable num tours.
In this function, m is an integer that represents the current move of the tour
(moves are labeled starting from 1). It is incremented at the beginning of each
call to move to indicate at what point along the tour the knight reached the
chessboard cell at indices row, col. In each call to move, you will record the
value of m in the private member variable board at position row, col. Next,
you will find all valid knight moves reachable from position row, col using the
function get moves. For each new move found from get moves, recursively call
move to find all remaining tours.
When m equals the total number of cells in the private member variable board,
it means a tour has been completed. Every time a tour has completed, you will
print board using the provided function print.

Explanation / Answer

here is your program : ------------>>>>>>>>>

#ifndef KNIGHTS_TOUR_H
#define KNIGHTS_TOUR_H

#include <vector>
using namespace std;

class KnightsTour {

public:
KnightsTour(int board_size);
int generate(int row, int col);

private:
void move(int row, int col, int& m, int& num_tours);
void get_moves(int row, int col, int row_moves[], int col_moves[], int& num_moves);
void print();

int board_size;
vector<vector<int> > board;

};
#endif

void KnightsTour::print(){

}

void KnightsTour::get_moves(int row,int col,int row_moves[],int col_moves,int &num_moves){

}

void KnightsTour::move(int row,int col,int &m,int &num_tours){
m++;
if(m == board_size*board_size){
  num_tours++;
  print();
  return;
}
board[row][col] = m;
int row_moves[8];
int col_moves[8];
int num = 0;
get_moves(row,col,row_moves,col_moves,num);
for(int i = 0;i<num;i++){
  move(row_moves[i],col_moves[i],m,num_tours);
}
}