Questions tagged [knights-tour]

A knight's tour is a sequence of moves of a knight on a chessboard.

223 questions
2
votes
2 answers

Knight's tour recursion doesn't find a solution

Knight's tour was asked before, but I'm still having trouble with it. I'm trying a recursion to visit all cells of chessboard but I can't make more than 52 visits. After that it backtracks and the number of visited cells counts down. Here is my…
Behnaz
  • 63
  • 1
  • 11
2
votes
1 answer

Knights Tour recursive C# Im getting something wrong in my way of doing the stuff

class Knight { public static readonly double LegalDistance = Math.Sqrt(5); public Stack Steps { get; set; } private static readonly List board = Board.GameBoard; private static List fields; private…
Daniel Tok
  • 207
  • 1
  • 9
2
votes
5 answers

Knight's Tour on a 5 x 5 Board Start from any Square?

I'd just like to check my logic here... I wrote code to solve the Knight's Tour and it works well for 8x8 boards starting the Knight at any square. But... on a 5x5 board I show no solution possible when starting at square (0, 1). What I tried for…
Matt M.
  • 812
  • 3
  • 16
  • 24
2
votes
1 answer

Importance of order of the operation in backtracking algorithms

Order of operation in each recursive step of a backtracking algorithms are how much important in terms of the efficiency of that particular algorithm? For Ex. In the Knight’s Tour problem. The knight is placed on the first block of an empty board…
sb15
  • 313
  • 5
  • 18
2
votes
1 answer

Knights tour - results in an infinite loop and i can't figure out why

I'm trying to solve the knight's tour problem using backtracking. I think the algorithm I have should work. I've tried but I can't figure out why it isn't working. It results in an infinite loop. However if I comment out the line that back track…
12rad
  • 829
  • 2
  • 13
  • 28
2
votes
1 answer

Knights tour backtracking lasts too long

How long does it last to solve the knights tour problem with backtracking on an 8x8 board? Because my algorithm already computes somehow too long and it seems, like it wont finish. But when I try a 6x6, or 5x5 board, it finishes successfully. the…
user2208931
2
votes
0 answers

Alternative to backtracking and to speed up program

I was trying to make a knights tour problem solution and i have just made it. Now i want to improve it.It takes the starting value and then outputs the step by step instructions to move (in command line output). Now the technique which i have used…
Ali Raza
  • 191
  • 2
  • 12
2
votes
2 answers

Knight's Tour backtracking infinite loop

I'm trying to write code for the Knight's Tour: A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square exactly once. I've been trying to alter someone else's code, but the backtracking seems to…
Oleksiy
  • 37,477
  • 22
  • 74
  • 122
2
votes
2 answers

Algorithm for knight's tour on a 6x6 array only works on index [0, 0]

I must mention that this is my first time posting on this site, forgive me if I don't follow this site's guidelines to the tee. My problem is probably simple but I can't understand it. My knight's tour algorithm recursively finds a path for a…
Miles Peele
  • 325
  • 5
  • 15
2
votes
2 answers

Fast algorithm to find closed knight's tour

I'm learning about knight's tour algorithm. I implemented using recursive fine but it take a long time and almost not a closed tour. Now, I'm currently finding a fast algorithm for finding closed tour. Can someone recommend me some…
Bình Nguyên
  • 2,252
  • 6
  • 32
  • 47
2
votes
3 answers

Knight's Tour using a Neural Network

I was looking at the knights tour problem and decided to have a go at implementing it in python using a neural network to find solutions. The general explanation of the method can be found on Wikipedia While I think I have implemented it correctly…
Yacoby
  • 54,544
  • 15
  • 116
  • 120
2
votes
1 answer

Method call within an array statement causing program to "hang"

I have written a program based on trying to solve the Knight’s Tour problem. I believe I have come up with an appropriate solution and everything looks fine. The small issue I am curious about is with a small section of code which implements the…
cryptoshiva
  • 63
  • 1
  • 5
2
votes
3 answers

The knights tour. Chosing a container

I have been reading up on C++ lately, especially STL, and I decided to do the Knights Tour problem again. I'm thinking about the best way to implement this, and I'm looking for some help. Just for fun and practice, I thought I'd start with a…
Q-bertsuit
  • 3,223
  • 6
  • 30
  • 55
2
votes
3 answers

How can this knight's tour algorithm be fixed?

In the 8X8 chess board, taking only knight into consideration, if we start the knight from any square of the chessboard, the aim is to cover max number of square , without repeating any square . so far I have found the most efficient solution with…
Ratan Kumar
  • 1,640
  • 3
  • 25
  • 52
1
vote
1 answer

Knights tour problem with an irregular chessboard

the knights tour problem is a problem based on backtracking. In the normal version you have a N*N chessboard and you have to visit every single field on the board with your knight. But here comes the real problem: I can visit every field only once!…
1 2
3
14 15