// Global variables:
const int chessSize = 8;
const int hor[chessSize] = {2, 1, -1, -2, -2, -1, 1, 2};
const int vert[chessSize] = {-1, -2, -2, -1, 1, 2, 2, 1};

// Prototypes
// Returns true if there is another valid move from our position
// It is true if can get to a position that equals zero
bool moreValidMoves(int row, int col, int board[][chessSize]);
// Sets row and col to the next move using a brut force method
void chooseMove(int &row, int &col, int board[][chessSize]);
// Prints the current board
void printBoard(int board[][chessSize]);

int main () {

  int table[chessSize][chessSize] = {0};
  int curRow, curCol;
  int count = 1;

  // Prompt the user for starting positions

  // set curPos in the table to count for our first move
  table[curRow][curCol] = count;

  // Move around the board while there are still valid moves
  while (moreValidMoves(curRow, curCol, table)) {
    int newRow = curRow;
    int newCol = curCol;
    chooseMove(newRow, newCol, table);
    // Set curRow and curCol to the position choosen
    curRow = newRow;
    curCol = newCol;
    table[curRow][curCol] = ++count;  // pre increment
  }

  cout << "There were " << count << " moves." << endl;
  printBoard(table);
}
