A knight's tour is a sequence of moves of a knight on a chessboard.
Questions tagged [knights-tour]
223 questions
0
votes
1 answer
Recursive backtracking knights tour in c ++
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…
0
votes
3 answers
Knight tour find path algorithm
I must start from [0,0] and visit all square then return/sit on [0,0]
Image from my board
This is the code I have attempted:
public class chess_F
{
// save my current position
struct position
{
public int row;
public int…

warrior
- 61
- 1
- 3
- 11
0
votes
2 answers
why two almost same implementation is having a big execution time difference?
I am trying to solve the Knight Tour problem using bactracking as given on this site.
Implementation given on the site takes about 0.49 seconds on ideone.
int solveKTUtil(int x, int y, int movei, int sol[N][N], int xMove[N],
int…

Eight
- 4,194
- 5
- 30
- 51
0
votes
1 answer
Knight Tour using Depth-First-Search algorithm
I'm trying to make program knight tour using DFS but I can't solve this program.. because I alway have a message error like this
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
at…
-1
votes
1 answer
Parallel Processing did not increase the efficiency?
I am learning about AI and read about Parallel Processing. Here is the code I copied the code solving Knight Tour Problem to test:
# Python3 program to solve Knight Tour problem using Backtracking
# Chessboard Size
# starting time
start =…

Ngọc Nguyễn
- 19
- 3
-1
votes
1 answer
Problem in Knights Tour using backtracking
I am getting a infinite loop when I try and run my solution for the Knights Tour problem using Backtracking
My Solution Code:
Link: https://ideone.com/Ud92vF
code:
#include
using namespace std;
bool valid(int arr[8][8],int r,int…
-1
votes
1 answer
When I compile my program,it displays "segmentaion fault (or) segmentation fault(core dumped)
When I compile my program, it displays
segmentaion fault (or) segmentation fault(core dumped)
My code seems to be working sometimes it gives the number of knight moves on the whole chessBoard, when moved on a square randomly chosen from all other…

Afrah mohd
- 21
- 5
-1
votes
1 answer
Knight's Tour Infinite loop
I wanted to test if I understand well the backtracking, so I tried the Knight Problem. But my code doesn't seem to work. It seem to do an infinite loop, so maybe my tracking of the path is not well executed. So I wanted to know what I miss in my…
user4699462
-1
votes
1 answer
Chess knight tour using recursive backtracking
My chess knight tour code using recursive-backtracking is not working.
#include
using namespace std;
// goal: knight tour
#define N 8
void printArray(int board[N][N])
{
for(int i = 0; i < N; i ++)
{
for(int j = 0; j < N;…

Berry
- 11
- 1
- 2
-1
votes
2 answers
I think I have a memory leak?
I am trying to do the Knight's Tour using dynamic arrays because the user will be able to implement their own board size, and where they want to start the knight at in the board.
However, before I changed everything to dynamic arrays, I was able to…

Cavustius
- 9
- 2
-1
votes
1 answer
Trouble with If/Else Statements to move through 2d array
Working on a version of the knight's tour. The program is not acting the way I think it would given my code. I am getting several different strange discrepencies. The 'knight' is going out of bounds though I set up paramters for it not to. There are…

cparks10
- 377
- 2
- 14
-1
votes
1 answer
Knight's tour in C++
I have this knight's tour problem that I have to solve. I have to input a NxN matrix and the coordinates of the knight, where (1 , 1) is the bottom left element. Now the program works correctly, however my problem is that the task states that there…

k.gerilovski
- 35
- 10
-1
votes
2 answers
Knight's tour abnormal behavior
So here is my code for the knight's tour problem, and I have been pulling my hair out trying to figure out what is wrong with it.
#include
#include
using namespace std;
void Knights_tour(int x, int y, int move_count);
bool…

G. Petter
- 5
- 2
-1
votes
1 answer
In the knights tour challenge, from the coordinates the player is currently on to show the user where they can move
This is from my attempt at the knights tour game, and what I was trying to do here was show the user what moves they could make from whatever position they are in, in the array.
The problem arrives with NextPos[x+1][y-2]!=null in the if statement, …
-1
votes
1 answer
Knight's Tour algorithm
I am new to programming and i want resolve Knight's Tour as practice.
But I don't understand where is the error on my program
Here is my method:
class Knight
{
int N, M;
bool[,] board ;
public Knight()
{
N = 5;
…

SantiagoGlz
- 17
- 3