ç Knight's Tour Notes Index

Closed Knight's Tours of the 6 by 6 Board

Enumeration, quaternary symmetry, binary symmetry, catalogue of all asymmetric closed knight's tours of the 6×6 board, methods of construction and enumeration, cell coding method, border method, straights and slants method, central angles method, combining the methods.

  • Practice Backtracking
  • Interview Problems on Backtracking
  • MCQs on Backtracking
  • Tutorial on Backtracking
  • Backtracking vs Recursion
  • Backtracking vs Branch & Bound
  • Print Permutations
  • Subset Sum Problem
  • N-Queen Problem
  • Knight's Tour
  • Sudoku Solver
  • Rat in Maze
  • Hamiltonian Cycle
  • Graph Coloring
  • Backtracking Algorithm
  • Introduction to Backtracking - Data Structure and Algorithm Tutorials
  • Difference between Backtracking and Branch-N-Bound technique
  • What is the difference between Backtracking and Recursion?

Standard problems on backtracking

  • The Knight's tour problem
  • Rat in a Maze
  • N Queen Problem
  • Subset Sum Problem using Backtracking
  • M-Coloring Problem
  • Algorithm to Solve Sudoku | Sudoku Solver
  • Magnet Puzzle
  • Remove Invalid Parentheses
  • A backtracking approach to generate n bit Gray Codes
  • Permutations of given String

Easy Problems on Backtracking

  • Print all subsets of a given Set or Array
  • Check if a given string is sum-string
  • Count all possible Paths between two Vertices
  • Find all distinct subsets of a given set using BitMasking Approach
  • Find if there is a path of more than k length from a source
  • Print all paths from a given source to a destination
  • Print all possible strings that can be made by placing spaces

Medium prblems on Backtracking

  • 8 queen problem
  • Combinational Sum
  • Warnsdorff's algorithm for Knight’s tour problem
  • Find paths from corner cell to middle cell in maze
  • Find Maximum number possible by doing at-most K swaps
  • Rat in a Maze with multiple steps or jump allowed
  • N Queen in O(n) space

Hard problems on Backtracking

  • Power Set in Lexicographic order
  • Word Break Problem using Backtracking
  • Partition of a set into K subsets with equal sum
  • Longest Possible Route in a Matrix with Hurdles
  • Find shortest safe route in a path with landmines
  • Printing all solutions in N-Queen Problem
  • Print all longest common sub-sequences in lexicographical order
  • Top 20 Backtracking Algorithm Interview Questions

The Knight’s tour problem

Backtracking is an algorithmic paradigm that tries different solutions until finds a solution that “works”. Problems that are typically solved using the backtracking technique have the following property in common. These problems can only be solved by trying every possible configuration and each configuration is tried only once. A Naive solution for these problems is to try all configurations and output a configuration that follows given problem constraints. Backtracking works incrementally and is an optimization over the Naive solution where all possible configurations are generated and tried. For example, consider the following Knight’s Tour problem. 

Problem Statement: Given a N*N board with the Knight placed on the first block of an empty board. Moving according to the rules of chess knight must visit each square exactly once. Print the order of each cell in which they are visited.

The path followed by Knight to cover all the cells Following is a chessboard with 8 x 8 cells. Numbers in cells indicate the move number of Knight. 

knight-tour-problem

Let us first discuss the Naive algorithm for this problem and then the Backtracking algorithm.

Naive Algorithm for Knight’s tour   The Naive Algorithm is to generate all tours one by one and check if the generated tour satisfies the constraints. 

Backtracking works in an incremental way to attack problems. Typically, we start from an empty solution vector and one by one add items (Meaning of item varies from problem to problem. In the context of Knight’s tour problem, an item is a Knight’s move). When we add an item, we check if adding the current item violates the problem constraint, if it does then we remove the item and try other alternatives. If none of the alternatives works out then we go to the previous stage and remove the item added in the previous stage. If we reach the initial stage back then we say that no solution exists. If adding an item doesn’t violate constraints then we recursively add items one by one. If the solution vector becomes complete then we print the solution.

Backtracking Algorithm for Knight’s tour  

Following is the Backtracking algorithm for Knight’s tour problem. 

Following are implementations for Knight’s tour problem. It prints one of the possible solutions in 2D matrix form. Basically, the output is a 2D 8*8 matrix with numbers from 0 to 63 and these numbers show steps made by Knight.   

Time Complexity :  There are N 2 Cells and for each, we have a maximum of 8 possible moves to choose from, so the worst running time is O(8 N^2 ).

Auxiliary Space: O(N 2 )

Important Note: No order of the xMove, yMove is wrong, but they will affect the running time of the algorithm drastically. For example, think of the case where the 8th choice of the move is the correct one, and before that our code ran 7 different wrong paths. It’s always a good idea a have a heuristic than to try backtracking randomly. Like, in this case, we know the next step would probably be in the south or east direction, then checking the paths which lead their first is a better strategy.

Note that Backtracking is not the best solution for the Knight’s tour problem. See the below article for other better solutions. The purpose of this post is to explain Backtracking with an example.  Warnsdorff’s algorithm for Knight’s tour problem

References:  http://see.stanford.edu/materials/icspacs106b/H19-RecBacktrackExamples.pdf   http://www.cis.upenn.edu/~matuszek/cit594-2009/Lectures/35-backtracking.ppt   http://mathworld.wolfram.com/KnightsTour.html   http://en.wikipedia.org/wiki/Knight%27s_tour  

Please Login to comment...

Similar reads.

  • chessboard-problems
  • Backtracking
  • Mathematical
  • Google Releases ‘Prompting Guide’ With Tips For Gemini In Workspace
  • Google Cloud Next 24 | Gmail Voice Input, Gemini for Google Chat, Meet ‘Translate for me,’ & More
  • 10 Best Viber Alternatives for Better Communication
  • 12 Best Database Management Software in 2024
  • 30 OOPs Interview Questions and Answers (2024)

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

  CH ESMAYNE

Midi : Want   “ When I need U ”

Knights Tours

T he KT puzzle where the KT lands on every cell only once are called “The KT s Tour”.    At the following link you will find an animated Tour and another link to a website with several different Tours .   

http://www.chess-poster.com/english/chesmayne/the_knight.htm

P uzzle.    The KT is moved on 64 occasions, entering each cell only once during this tour.   The solution is called ‘re-entrant’ if the KT finishes in a cell which is a KTs move away from the starting cell.    The other knights of Chesmayne may be used in the same manner ( KN , SB , KM etc).    The number of possible KT tours is 122+ million.   

C ould you do the ‘KTs Tour’ in three minutes in front an audience of millions?    That is exactly what Paul Broad from Cardiff , Wales did on the ITV show ‘The Moment of Truth’ hosted by Cilla Black.    Paul had a week in which to memorise the KTs tour across the board before testing out his memory in front of millions of views in the UK .     Paul completed the Tour successfully!  

I n a KTs Tour the Knight must travel to every square/cell on the board without entering any cell more than once while moving in an L-shape as it normally would in a game of chess .    There are many ways of achieving this.    The example which follows shows one variation.    The KT starts on the cell numbered one and travels to each cell in numerical order, finishing on cell 64.

A Knights Tour

“Knight’s Tour” is a puzzle which has amused chess players throughout the ages. The goal of the KT is to traverse around the board, landing on each cell but once.    There are numerous solutions.    Here’s one – with an animation…….

Here’s another one:

The above two paths are known as ‘closed’ or ‘re-entrant’ paths.    The KT, after completing its journey, lands on the 64 th cell, which is also the cell that it started on.    Thus, it can complete the journey again.  

This is considered much more of an elegant solution than the many “open” paths, one of which is shown here:

As you can see, the KT still lands on each of the 64 cells.    However, he isn’t able to complete the journey a second time.    In this tour, the KT starts out here on the h8 cell, but ends up on c6... more than a KTs move away.  

Not only is this next example a ‘re-entrant’ path, but it’s considered a somewhat semi   magic square.    Each of the columns, add up to 260!

However, this one must be considered a “SUPER” magic square which may have been created by the mathematician Leonhard Euler.  

01 Each column adds up to 260!

   02 Each row also adds up to 260!

HOW MANY SOLUTIONS ARE THERE?

I.A. Horowitz and P. L. Rothenberg have stated:

“The number of possible ‘KTs Tours ’ lies somewhere between 122,802,512 and 168! / (105!)(63!)”   

T he “KTs Tour” is an ancient puzzle in which the object is to move a KT, starting from any cell on a chessboard, to every other cell, landing on each cell only once.    This is usually considered to be a very challenging puzzle, so the discovery of the solution described below came as quite a surprise!    To learn more about KT Tours, explore the links below (and watch for new additions to this site in the near future).   

This site is sponsored by Borders Chess Club

KTs Tour Art

T he following Knight’s Tour reflects simplicity, beauty, and semi-symmetry in which the two left quadrants show the same path of the KT, while the two right quadrants mirror the path.    Please contact me if you have created interesting KT tours.    I will pick the best ones and add them to this section of the webpage.  

Click on the image above for a static view

A nother interesting tour gem, a mini-KT tour of only 16 moves, can be used to create the most amazing geometric pattern called a 4 th dimensional hypercube.    The path of the KT could be: d8, b7, a5, b3, d2, f3, g5, f7, d6, c4, e5, c6, d4, e6, c5, e4.   By placing a dot in the center of each cell that the KT moves to, then connecting each dot with a line that represents a legal KT move, the end result is a perfect 4 th dimensional hypercube.   Notice that there are 16 different cubes, all of which have the same exact dimensions, inside the hypercube.   Can you find them?  

B elow you will find an interesting pattern that can be repeated over and over again to make larger and larger closed KT tours.   The pattern comes from my ‘Closed KTs Solution Key’.    Ceramic tiles, wood, or plastic can be cut into these basic shapes to make the secret closed KTs tour pattern.    The cut pieces could then be put on floors, walls, or table-tops.    For simplicity, create the pattern for an 8 x 8 square board.    Do not put numbers on the top of the pieces.    If you want to make it into a puzzle, cut out the pieces and put the corresponding numbers on the back of the pieces in a very light shade or impression.   

W hen I practice creating KT tours on paper with checkerboard squares, I can quickly complete an 8 x 8 square closed KTs tour in 15 seconds by marking off each KT move on the squares with the following symbols: /, -, \, |. I first use ‘/’ for all diamond shape patterns leaning in the same direction as ‘/’ in all four quadrants.    I then use ‘-‘ for square shape patterns in all four quadrants, then ‘\’ for the opposite diamond patterns, and finally ‘|’ for the opposite square patterns.   

I might consider making a cool poster out of it or some of the other tours I’ve created.   There is a definite symmetrical pattern.    Just think, by creating that one quadrant, it can be used as computer wallpaper, web page background, watermarks, or quilts by tiling it.    Experiment by changing the line colour and thickness, and the tile colour.    By combining these four shapes in various ways, alphabets, number systems, and ciphers can be easily created.    Who knows, maybe there could be a fictional story written that centers its plot around the patterns in the ‘Secret Closed KTs Tour’.   

www.BordersChess.org/KTart.htm   modified 2002.03.06

The KTs Tour

  An Extremely Simple Solution

I would like to share a KTs Tour I created by using a very simple rule I devised that requires no memorization:   Start at any corner and continuously rotate in the same direction around the board moving on the outermost squares.    The moves create a semi-symmetrical pattern around the board.    The tour is completed with only four trips around the board.    Feel free to post this solution on your web-pages, other publications, or with other KT Tour enthusiasts.    Please reference my name and e-mail address when posting my design and KTs Tour solution.   

I originally created the chessboard in Excel which I could also use to automatically sum the rows, columns, and diagonals.   My KTs Tour does not reflect a ‘ Magic Square ’ but does provide an extremely simple solution.    I recreated the board in Visio and added the red lines to show the symmetry.    Connecting the sequential moves is fun to do with other KT Tours, Magic Squares, and Magic Cubes to come up with different designs.  

I n addition to being fun, the KTs Tour puzzle also helps chess students to develop their ability to visualize tricky KT move sequences.    The Greater Knoxville Chess Club’s director wrote: “Thanks for the brainwork!    I just started using the KTs tour as an instructional device two weeks ago with my students.   Lev Alburt gives a solution in ‘Comprehensive Chess Course’ starting with a KT on d3.   Your solution with the KT starting from a corner is what I told my students that I would develop a methodology for.    Now I don’t have to do nothing but present your work!    Thanks for the assist - you must have read my mind!”  

Reader Feedback on Thomasson's Knight's Tour Solution

[Intro]   [Semi-Magic Square Knight Tours] [Knight's Tour Art]   [Closed Knight Tours]   [Solving with Number Pairs] [Knight Tour Cube]   [Knight Tour Tessellations]   [Links to Knight Tours]

www.BordersChess.org/KTsimple.htm   modified 2002.03.06

Closed (Reentrant) KT Tours

I n the early 1940s, GM George Koltanowski toured the countryside providing KTs tour demonstrations at various chess clubs and tournament events.

Grandmaster George Koltanowski, 1903-2000 copyright(C) 2000, San Francisco Chronicle

H e used a closed (re-entrant) KTs Tour for his solutions.    “Closed” means that the KT moves to all cells on the chessboard making legal KT moves and covering every cell only once in which the last move can connect back to the starting position (64 connects back to 1).   This is also known as “reentrant”.   A member of the audience would ask him to block out a cell on an 8 x 8 chessboard.    He would begin making his KT moves from that cell and then return to that cell with his last move.  

Here is my thought process for creating a closed KT tour.  

When I create a tour, I think of diamond and square patterns and the letters U and C.  

I divide the board into four quadrants, start with the top left quadrant, then place the diamonds and squares in their respective quadrants following the directional patterns of the letters U and C.  

Check out the following steps:

Step 1: I create the same diamond pattern in all four quadrants using the directional pattern of the letter U.

Step 2: I repeat step 1, but instead of diamonds, I create the same square pattern in all four quadrants.

Step 3: I create the same diamond pattern in all four quadrants using the directional pattern of the letter C.

Step 4: I repeat step 3, but instead of diamonds, I create the same square pattern in all four quadrants.

click on the image above to see an elaborated version

L ook at the closed KTs Tour below where I alternate the diamond and square pattern for each quadrant.    The result is the same - a completed closed KT tour.    What once seemed impossible to do without the aid of a computer is now possible and extremely simple.   

T he figure below shows a closed KTs Tour on a 16 x 16 cell board.    The pattern used in this example is the same pattern or solution that I use on boards with 1024, 4096, or even 10816 cells.    For speed and ease of completing such large tours, it is best to use the same closed tour in the 16 x 16 board that I’ve provided, but begin the tour from the top left cell.    In other words, make square 190 = 1, 191 = 2, 192 = 3, ... etc., all the way around the board until the tour is completed.    You will see just how easy it really is!   

I created the pattern in this solution key which I used to solve the 16 x 16 board KTs Tour, and it can be used on larger boards such as 32 x 32 cells, 64 x 64 cells, 104 x 104 cells, along with other board sizes.   

[Intro]   [Simple Solution]   [Semi-Magic Square Knight Tours] [Knight's Tour Art]   [Solving with Number Pairs] [Knight Tour Cube]   [Knight Tour Tessellations]   [Links to Knight Tours]

www.BordersChess.org/KTclosed.htm   modified 2002.03.06

Link to: KTs tour program

T his WWW page is for a shareware MS-DOS program that solves the KTs Tour puzzle (visit all 64 cells/squares with one KT ).   The small program (50k) can be downloaded from this site.    While the author of this site doesn’t mention it, it is nice to know that the KTs tour puzzle is more than 1,000 years old.

§          http://www.gfcs.demon.co.uk/tour/ KTs tour program.

§          From: ‘Chess Variants’ web page.  

Worse than Worthless

By ralph betza.

Something that is worthless has zero value.    What could be worse?

Negative Money

M y dentist told me the fee for today’s visit was zero, and he hoped I had that amount with me.    Ha ha.

I immediately went into an uncommunicative reverie, thinking about negative-valued money.    If I owe you ten dollars, you can give me a minus-ten dollar bill.

T here would need to be severe penalties against destroying or discarding or even hiding negative money, to prevent its abuse.    Imagine the anti-miser, who lives well beyond his apparent means and after death is discovered to have a huge stash of negative money hidden in a mattress.

S trangely enough, negative money has some positive value.    If you have a debt, you pay interest on it, but if you have negative cash, it is like having an interest-free loan. Therefore negative money would be somewhat sought after, as people would try to keep all their liabilities in uncash.  

Counterfeit negative money would not be a problem.

The Negative Relay Knight

I n the mid 1970s, I did an article for NOST-algia in which I explored “all possible” variants of Relay Chess .    One such variant allows only your opponent to benefit from the relay powers.

C onsider a piece that moves as a KT but has no capturing powers; instead, any enemy piece a KTs move away from it gains temporarily the power of moving or capturing as a KT.    This is a piece of negative value!   

F ollowing Mannis Charosh’s rules, the enemy KI cannot benefit from the relay power, and the enemy PAs cannot use this power to move to their first or eighth ranks.    However, I will break from the Charosh tradition and allow the Negative Relay KT to give an enemy Negative Relay KT the temporary power to move or capture as KT, and my reason for doing so is that I have seen that the resulting tactics are piquant and charming.   

U sing the above rules, and replacing each side’s KTs with Negative Relay KTs, we get a simple game called Negative Relay Chess.    Here is a sample opening:  

1. NegRelayNb1-c3 d7-d5 2. NegRelayNc3-e4 e7-e5 3. NegRelayN e4-f6+ NegRelayNg8-h6 4. NegRelayNf6-g8 ; and White has succeeded in burying his negative-valued piece deep in enemy territory where it blocks enemy moves and where the benefits the foe gains from it are less dangerous (but where the opponent is more likely to be able to get pieces in range of it).    This is a strategy that might be worthless or worse, and to achieve it W has lost several tempi.   

M eanwhile, the pieces at h6 and g8 temporarily give each other the ability to capture. Notice that the Negative Relay KT can be captured, but can be used as though it were uncapturable because, due to its negative value, capturing it is usually undesirable.   

T he move 3.Ne4-f6+ tries to force the capture of the liability.    Instead, Black’s reply 3...Ng8-h6 provides an illustration of the temporary nature of the relay power.   The sample game is very short, but provides insight into the rules, the strategy, and the tactics; I think it’s a pretty good sample game!   

T here is absolutely no doubt that one can play Negative KT Relay Chess with Different Armies.   Beware confusion and danger of illegal moves when negative KT and negative Fibnif mutually attack.  

What’s it Worth?

T he Negative Relay KT has some small potential positive value, because it could be used to blockade a passed PA or to make tempo moves in the late endgame.    In fact, in the late endgame, because there are so few enemy pieces to be helped by it, it might even have a very small positive value overall.

I ts whole-game value can be estimated as the amount of average mobility it gives to the enemy times the chance that it does so, and the chance that it does so is its own average mobility times half the probability that a random CELL is occupied.    That’s -4.59375, and since the KTs positive average mobility is 5.25, replacing a KT with a Negative Relay KT makes your army weaker by 9.8, or one and seven-eighths of a KT; in other words, replacing a pair of KTs with Negative Relay KTs should theoretically make your army 11.25 PAs weaker!   

B ecause the KT starts at g1 and b1, where its friendly PAs shield it from undesired contact with enemy pieces, an army that has 3.75 KTs’ worth of power distributed among its other pieces might be able to simply win with its other pieces while leaving its negative-valued KTs at home, right?    The positive value of having a worse than worthless piece in your army is that you get to have so much power added to your other pieces!   

M aybe not.    With the funny material balance, the levelling effect will hurt the pieces that have added powers - for example if you have Cardinals instead of BSs, the enemy BSs gain the ability to chase your Cardinals away.   

I n order to keep the strategy of keeping the negatives at home from being too strong, I’m going to avoid giving jumping moves as enhancements to any of the pieces.    This means that the negative pieces, if left at home, will have the added liability of being in the way of smooth development.    Also, because the army with negative pieces has to move PAs to develop, it must break up the PA formation that shields the liabilities from contact with the foe.   

L et’s let the RO have the additional power of moving as a three-cell limited BS (that is, as a BS3 that can’t move farther than from a1 to d4), and the BS also move as RO2 (making normal BS moves or short RO moves, for example f1 to f3 but no further).  

I haven’t worked out the exact arithmetic of that, but it’s close enough to be worth a try.    It feels right, too.    But omigosh, what an experimental army, how exotic it is, and oh, so great a chance that it is too weak or too strong!    My brain is tired and I can’t playtest it blindfold; but it’s such an exciting idea, and such a crazy army, I can’t resist publishing it as is, just eight hours after the dentist’s joke, with apologies if it needs to be corrected later.   

The Nattering Nabobs of Negativity

The Nattering Nabobs of Negativity[1] are a highly experimantal and untested army intended to fit into the framework of Chess with Different Armies .

The QU, KI, and PAs are the normal FIDE Q, K, and P.

The R is the FIDE Rook plus short bishop of length 3 - RB3 - and because it ought to have a name I’ll call it a Rhubarb .

The B is the FIDE Bishop plus short Rook of length 2 - R2B -- Rutabaga is its name.

The KT is a Negative Relay KT, as described previously in this document.    It’s called the Ruthven , named after the Murgatroyd whose family curse made his title of nobility worse than worthless.  

Strangenesses

I don’t have the energy to discuss the following ideas in complete detail.

Asymmetrical Relay

“ I ts whole-game value can be estimated as the amount of average mobility it gives to the enemy times the chance that it does so, and the chance that it does so is its own average mobility times half the probability that a random cell is occupied”.   Perhaps you can detect that my particular way of phrasing that statement encompasses the possibility of a piece moving as KT, and granting any piece a KIs move away from it the right to move as a RO or to capture as a BS?  

Promiscuous Negative Relay

N otice that friendly pieces are not affected by the relay power of a friendly piece. Unfortunately, the opening position is so crowded that if a friendly PA a KTs move away from a friendly KT gained the liability of being used by the enemy to move or capture as a KT, chaos might ensue.    However, since PAs may not move to their own first rank, the game might be playable?    But if Pd2 captures Bf1 and Bf1 is also a liability, then the capture would be undesirable.   

T herefore a game in which all pieces (except perhaps KI) are negative relay pieces both to friend and foe might be playable after all!  

Huge Negative Values

“ I ts whole-game value can be estimated as the amount of average mobility it gives to the enemy times the chance that it does so, and the chance that it does so is its own average mobility times half the probability that a random cell is occupied”.    For a symmetrical relay piece, that is, in the natural case where the power of movement is the same as the power granted, the negative value varies as the square of the average mobility of the power.    In other words, the negative relay Amazon would have in theory sixteen times the negative value of the negative relay KT!    Sixteen times!  

T hat’s more negative value in one piece than the positive value of an entire normal army of pieces!  

  [1] Phrase coined by William Safire for a speech by Spiro T. Agnew .

Written by Ralph Betza.

The Distribution of the KT

·          Given a chessboard with n x m cells, find a path for the KT that visits every cell exactly once.  

F or example, here is a solution to the KTs tour problem on a 3 x 10 chess board.    In this example, the KT starts out in the lower left corner and ends in the bottom right corner:  

I f we started on the second square on the first row, would it still be possible to find a solution?    More generally, what does the distribution of solutions across the chessboard look like?    That is, for every given starting point, how many solutions exist?

T his problem can be solved by computer: for every given starting point, evaluate every possible path that visits each square exactly once, and then count how many solutions exist.    We used Mathematica to do this hunt…….  

W e present here the distribution of solutions across a chessboard, for all chess boards with 32 or less cells.  

Select a chessboard from the menu on the left.

Related Links

·          Java Game

·          Arnd Roth's page - an improvement to Warnsdorff’s algorithm.

·          Combinatorial Object Server - the KTs tour and sequences.

·          References and more

·          Schröer and Wegener's paper - (a GZipped postscript file): section 7 derives the (currently) smallest known upper bound on the number of solutions on a 8 x 8 board: the bound is 2.544 * 10 17 .

·          Chess on Stamps - KTs, chess, and more.

Chess KTs and the like   

1956 question - how many of these are there?

P atent 694038 (1902) by W E Stubbs patented a KTs tour on a 6 x 6 board.    See GP Jelliss's page for the history of this problem .    The Stubbs puzzle used a pegboard and pegs joined with cord.    To solve the puzzle, all the lengths of cord between the pegs had to be taut.     Suppose that you had a 5 x 5 grid of pegs.    Some holes are already filled, perhaps.    With 15-25 pegs, is there a series of lengths so that the pegs can only be put away tautly in a unique way?   

I n the March 1973 issue of Games and Puzzles, Robin Merson found a non-crossing KTs tour on an 11 x 11 board with a length of 74 moves.     He found a longer non-crossing tour on a board with a smaller area.    Can you find it?   

R oger Phillips has found a smaller board with a longer uncrossing tour.  A 10 x 12 board allows for a length 75 tour.     I’ve moved the material from a few weeks ago to the Leapers page .   

J uha Saukkola wondered what the longest possible Knightrider tour might be.  A knightrider moves like a KT, by may keep going in a straight line.    Here is his answer.    What is the fewest number of moves for a knightrider to tour the chessboard?

Advanced Computing Technology has a program that solves large Leaper problems.

K eyed Tours .  Each path starts at the top left corner, and starts cycling through the KEY over and over again.     It will always take the direction suggested by the key IF a complete closed tour would still be possible.    There are three parts to the key.

1.  A direction key.  Below, a simple 1=N 2=E 3=S 4=W is used.    The eight paths of a knight could be labelled, or something more complicated.  

2.  A grid.  Below, a 6 x 6 grid is used.  The grid could be multidimensional, or hexagonal, or even a grid of chaos tiles.  

  3.  A code.  Each code will produce a unique path.  On a 50 x 50 grid, what path would result from a 12345678 code from a KT?  

CONSTANT LENGTH TOURS  by Ed Pegg Jr.

L eonhard Euler was the first to find a closed tour of a chessboard by a KT.  Other pieces, more exotic, exist in the realm of Fairy Chess.    Until now, their tour potential hasn’t been studied.    I’ll start with definitions, most of them standard Graph Theory terms.  

Point (vertex, node, junction, cell)

Line (edge, arc, branch)

Two points are adjacent (linked) if they are joined by a line.

A loop links a point to itself.  [None of the graphs in this paper contain loops.]

A line is incident to the points it joins.

The degree of a point is the number of lines incident to it.

Lattice - a graph where all points are midpoints of tiles in a regular tiling.    [I’ll deal with square tilings.]  

A graph is connected if there exists a sequence of points and lines from any point to any other point.

A Hamiltonian cycle is a loopless, connected graph where every point of the graph has degree 2.

A Hamiltonian path is a connected graph of N points with N-2 points of degree 2 and 2 points of degree 1.

A Re-entrant knights tour is a Hamiltonian cycle on an 8 x 8 lattice where each line has length.

Board:  m x n lattice of squares.

(Closed) Tour:  A Hamiltonian cycle on a lattice.

Open Tour:  A Hamiltonian path on a lattice.

Leaper:  A KT is a (1,2) leaper.  In the same fashion, (2,3) leapers and (1,4) leapers exist.

Constant Length Tour:  A tour where every line has a constant length, c.

   For c= sqrt(5), we get KT moves.  Question: What c’s allow a tour of the 8 x 8 board?  Answer: The only c’s that work are c=1, c= sqrt(5), and c=5.   No tour exists on the 9 x 9 board, due to parity.    For the 10 x 10 board, c=1, c= sqrt(5), c= sqrt(13), c= sqrt(17), and c=5 are the only c’s that allow a constant length tour.  

C = 1 corresponds to the (0,1) leaper and is called a Prince.

C = sqrt(5) corresponds to the (1,2) leaper and is called a KT.

C = sqrt(13) corresponds to the (2,3) leaper and is called a Zebra [traditional Fairy Chess].   C = sqrt(17) corresponds to the (1,4) leaper and is called a Giraffe.    Note that C =  sqrt(a^2 + b^2) corresponds to a (a,b) leaper.

T he standard puzzle seen in puzzle books involves the idea of parity.    An example of a parity argument: Prove that a KT cannot make a closed tour of an n x n chessboard, where n is odd.     Proof: fill in the board with a checkerboard colouring.  The KT will start on one of the two colours, let it be white.    After an even number of moves, the KT will be on a white cell.    The closed tour has an odd number of cells.    Since a closed tour would require the KT to land on its starting cell after an odd number of moves, the tour is impossible.   

   We will now prove:

   1.  There is no closed tour for a (1,2) leaper [KT] on a 4 x n board.    2.  There is no open tour for a (1,2) leaper on a 4 x 4 board.    3.  There is no open tour for a (1,4) leaper on an 8 x 8 board.    4.  There is no open tour for a (2,3) leaper on an 8 x 8 board.    5.  There is no open tour for a (2,3) leaper on a 9 x 9 board.    6.  There is no open tour for a (2,3) leaper on an 11 x 11 board.    7.  There is no open tour for a (2,3) leaper on a 12 x 12 board.  

   Note that the nonexistence of an open tour implies the nonexistence of a closed tour.

Proof A: Examine the black  points and grey  points of diagram 3.  The corner grey  points are adjacent only to the interior grey  points, the same applies to the black  corner points.  A closed tour is thus impossible, since these two colours are closed to the rest of the board.    However, we have the leeway of a spare move at the beginning and end of an open tour.  We can start with a black corner, eventually make a move from a black  interior point to the dot  points and clear  points, move to a grey interior point, and finish the tour.  Unfortunately, it is impossible to move directly from a dot point to a clear  point.    So an open tour is impossible.  

Proof B:  This proof exploits the idea of Proof 1.  Colour the outer columns as shown in diagram 4.    A closed tour is impossible, as described in Proof 1.    However, an open tour is possible on a 4 x n board, provided the move sequence looks something like the following: grey white grey...white grey grey-white ... grey white grey.    If we colour the top and bottom rows, we reach the same conclusion.  Combining these, a tour is possible as long as we move from a white point in diagram 5 to another white  point.    This is impossible.

Proof B: Colour the board as shown in diagram 7.    The grey points are adjacent only to clear and dot  points.    The closed tour is impossible, see proof 1.    An open tour might be possible if we move from a non-grey point to a non-grey point midway through the tour.  Rotate the diagram 90 degrees, and make the same observations.    A tour is possible if two dot points are tour-adjacent.   But they aren’t, so there isn’t an open tour.  

   A similar colouring scheme is useful for showing the impossibility of (a,b) leapers on small boards.

   This problem was first solved by Dan Cass.

   N ow then, using the methodology in Proof 1, note that the gray-shaded points are adjacent only to the white-shaded points.    Turn the diagram 90 degrees and note the same thing.    Combining, an open tour is possible only if we can move from a dot point to a dot point midway through the tour.    We can!    But this use of the only free move leads to the same closed system described above.    Thus the open tour is impossible.   

1. E xample: Take a look at a cell in a corner of the board.    From such a cell a KT can jump to only two other cells.    And the cell in the corner can be reached only from these two other cells - the cell in the corner has two “entrances”.    When a KT during a tour happens to visit any of these entrances, it is almost bound to visit the corner cell next.    If the KT doesn’t do that, it has used up one of the two free entrances of the corner cell - and thus turned that cell into a dead end; the corner cell can still be reached later, but there will no longer be any unused way out.   During a KTs tour the number of free entrances to all cells of the board are gradually used up.    Warnsdorff’s rule serves to direct the KT to the cells with the least numbers of free entrances left - before these cells have turned into dead ends.   

2. W arnsdorff’s rule gives solutions, but not all possible solutions (One can make moves opposing the rule and yet get a complete tour).    The rule possesses a trait of arbitrariness; there is often a choice between equal alternatives.    And on really big boards the rule runs into trouble.    Warnsdorff scarcely had the possibilities to explore this, but Arnd Roth at the Max-Planck-institut für Medizinische Forschung presents an investigation of this in "The Problem of the Knight"  

A strategy game for you and your computer

Take the Challenge

A chessboard is set with two KTs: one black, one white.    Yours is the white KT and you take the first move.    You alternate turns with the computer, but you lose if it’s your turn and you can’t move.    Sounds easy, right?   

T he pieces move just like knights in ordinary chess, but the trick is that cells disappear from the board when pieces pass through them.    Once you’ve been to a cell, neither you nor the computer can go there again.   

O ne strategy is to try and stay free so that you’ll never be caught without a possible move.    Another is to try and head off the computer KT so that it will be left without anywhere to go.    The computer does a little of each and plays a decent game.   

Click Here to Play On-line

O nce the game is loaded, you simply point and click on the board to move.    After the game ends, click the red button to play again.   

KTs’ Tourney requires version 5 of Macromedia’s Flash Player.    If you don’t have the plug-in, you can download it for free .  

About this Game

T he KTs Tour is a classic logic puzzle in the form of a chess problem: Is it possible for a chess KT to move through every cell on the board without revisiting any? The answer for the usual 8 x 8 chessboard is yes, but the general question for arbitrary board sizes has interested mathematicians working in the area of graph theory.    See, for instance, Mark Keen's paper on the subject. There are several on-line implementations of the original problem.   

KT’ Tourney is a two-player generalization of the KTs Tour which has been suggested by enough people that it’s hard to name one inventor.    This implementation of it is ©2001 by P.D. Magnus.   

CoffeeHouse - Java interface to Internet Chess Club   Grandmaster Java Chess Viewer

If you can’t see the frames at the left please click here

This page was designed and is maintained by David Roberts, [email protected] ©1997, 1998 David Roberts .

Links to More Knight Tours

Hi, You asked if I could give you a link.  I would like to share http://www.borderschess.org/KnightTour.htm  (The Knight's Tour).  KnightTour.htm  is in English and in German in order to reach a larger audience.  It describes how to solve open and closed knight tours along with other interesting knight tour puzzles such as closed knight's tour cube, magic/semi-magic squares, tessellations, and knight's tour art.   You will find many new items and updates on my web page that will enhance your Chesmayne Chess Dictionary.  Please feel free to make the necessary changes and updates to your section of Knight - Tour in your dictionary.   You may want to change the reference of Knight - Tour on http://chesmayn.valuehost.co.uk/K.htm  to "Knight - Tours". Also, on http://chesmayn.valuehost.co.uk/Knights-Tour.htm , please change the title of "Knights Tour" to "Knight Tours".   I have a new title banner and home-made navigation buttons for each page on KnightTour.htm.  Feel free to copy them for your use.  I've made several corrections to many of my web pages.  Please update your site with the new changes.   Nice Site you have at   http://chesmayn.valuehost.co.uk .  I think it will become very successful on the Internet.   Cordially, Dan.  

If you get a chance, take a fresh look at my Knight Tours web site:  www.borderschess.org/KnightTour.htm to see many new items.  I am applying for a patent on Springer Geometry.  Springer is the German word for "Knight" in English.  Springer Geometry is the geometry of polygons created by closed knight tours.  I hope you enjoy my new additions.  A patent search has already been completed, so now the patent attorney is ready to send my ideas in for a Utility Patent.  I am currently preparing information to send to Springer-Verlag, a math & science book publishing company, to see if they would be interested in publishing a book about my Knight Tours and Springer Geometry.  Their logo is the chess knight.

I've also finally decided to let my computer solve additional knight tours using Mathematica and code written by Dr. Colin Rose and modified by Michael Taktikos from Germany, and from myself.  The code has solved all unique 6x6 closed knight tours (9862 total).  I have included printouts on my web site of various other closed and symmetrical tours for smaller size boards.  Anyway, check it out and see if you like the new stuff.  Let me know if you have any ideas, comments, or criticisms.

Keep in touch.  Cheers,

Dan  

www.BordersChess.org/KnightTour.htm

www.ktn.freeuk.com

homepages.stayfree.co.uk/gpj/ktn.htm

www.velucchi.it/mathchess/knight.htm

enchantedmind.com/puzzles/knights/knight.htm

www.helsinki.fi/~vahaaho/KnightsTour/tour.html

www.helsinki.fi/~vahaaho/KnightsTour/doc/doc.html

student.lssu.edu/~gbharadw/java/knight.html

www.tcp-ip.or.jp/~toshio-t/K_tour.html

www.npac.syr.edu/projects/tutorials/Java/examples/KnightTour/Knight.html

w1.859.telia.com/~u85905224/knight/knight.htm

w1.859.telia.com/~u85905224/knight/eknight.htm

home.earthlink.net/~tfiller/knight.htm#

www.mactech.com/articles/mactech/Vol.14/14.11/TheKnight'sTour/

www.worle.com/chess/solution.htm

www.worle.com/chess/knight.htm#top

www.tri.org.au/knightframe.html

members.attcanada.ca/~ptah/knights.htm

www.inficad.com/~ecollins/knights-tour.htm

www.delphiforfun.org/Programs/knight's_tour.htm

www.uweb.ucsb.edu/~rjr/KnightsTour.html

mail.stuy.edu/pipermail/csteam/2000-October/000001.html

hercule.csci.unt.edu/~ian/papers/knight2.html

hercule.csci.unt.edu/~ian/papers/knight3.html

www.wordways.com/knights.htm

www.theory.csc.uvic.ca/~cos/inf/misc/Knight.html

ourworld.compuserve.com/homepages/John_Katrin_Sharp/Articles.htm

www.mathpuzzle.com/leapers.htm

www.reflexive.net/james/OldSoftware/

www.hctc.com/~dtriplet/link.htm#Puzzles

mathworld.wolfram.com/KnightsTour.html

mathworld.wolfram.com/KnightsTourGraph.html

www.math.niu.edu/~rusin/known-math/99/knights

www.markkeen.com/knight.html

www.singaren.net.sg/DAC/projects/magic.html

www.behnel.de/knight.html

www.combinatorics.org/Volume_3/Abstracts/v3i1r5.html

www.combinatorics.org/Volume_3/Comments/v3i1r5.html

cs.anu.edu.au/~bdm/papers/knights.ps.gz

www.ex.ac.uk/~dregis/DR/tour2.html

Some Closed Knight's Tours

A cyclic knight's tour is a sequence of knight's moves that visit every square of an n x n chessboard, returning to the first square. These are some images from Ian Parberry 's research on cyclic knight's tours in the 1990s. See these papers for more information. Some of the tours are generated by a random walk, one is generated by a neural network, some are generated by a divide-and-conquer algorithm that gives the tours a tiled look. Some are symmetric under rotations.

6x6, Random

The following small knight's tour was used as part of the base of the recursion in a divide-and-conquer algorithm described in Ian Parberry , "An Efficient Algorithm for the Knight's Tour Problem", Discrete Applied Mathematics , Vol. 73, pp. 251-260, 1997. [ pdf ].

8x8, Random

10x10, random.

The following small knight's tour was used as part of the base of the recursion in a divide-and-conquer algorithm described in Ian Parberry , "An Efficient Algorithm for the Knight's Tour Problem", Discrete Applied Mathematics , Vol. 73, pp. 251-260, 1997. [ pdf ]. You may have noticed by now that all of the closed knight's tours you have seen so far (6x6, 8x8, and 10x10) have even sides. That's because there can be no knight's tours on an odd-sided board (to see this, consider the fact that on a real chessboard, the squares visited in a knight's tour must alternate between black and white).

10x10, Invariant Under 90° Rotation

Closed knight's that are invariant under a 90° rotation exist on nxn boards for all even n at least 6 that is not divisible by 4 (Dejter, 1983). This tour is from Ian Parberry , "An Efficient Algorithm for the Knight's Tour Problem", Discrete Applied Mathematics , Vol. 73, pp. 251-260, 1997. [ pdf ].

12x12, Invariant Under 180° Rotation

Closed knight's that are invariant under a 180° rotation exist on nxn boards for all even n at least 10. This tour is from Ian Parberry , "An Efficient Algorithm for the Knight's Tour Problem", Discrete Applied Mathematics , Vol. 73, pp. 251-260, 1997. [ pdf ], as are the following 14x14, 16x16, 18x18, and 20x20 knight's tours.

14x14, Invariant Under 90° Rotation

18x18, invariant under 90° rotation, 20x20, invariant under 180° rotation, 26x26, found by a neural network.

The following was the largest closed knight's tour I could generate at the time using the Hopfield network of Takefuji and Lee. More details appear in Ian Parberry , "Scalability of a Neural Network for the Knight's Tour Problem", Neurocomputing , Vol. 12, pp. 19-34, 1996. [ pdf ]

The following was generated by a divide-and-conquer algorithm described in "An Efficient Algorithm for the Knight's Tour Problem", Discrete Applied Mathematics , Vol. 73, pp. 251-260, 1997. [ pdf ].

60x60, Random Walk with Warnsdorf's Heuristic

The following was generated by a random walk algorithm due to Euler in 1795 modifed with a heuristic due to Warnsdorf in 1823. It appears in Ian Parberry , "Scalability of a Neural Network for the Knight's Tour Problem", Neurocomputing , Vol. 12, pp. 19-34, 1996. [ pdf ]

Created April 23, 2010. Last updated November 18, 2022.

knight's tour 6x6 solution

  • Runestone in social media: Follow @iRunestone Our Facebook Page
  • Table of Contents
  • Assignments
  • Peer Instruction (Instructor)
  • Peer Instruction (Student)
  • Change Course
  • Instructor's Page
  • Progress Page
  • Edit Profile
  • Change Password
  • Scratch ActiveCode
  • Scratch Activecode
  • Instructors Guide
  • About Runestone
  • Report A Problem
  • 8.1 Objectives
  • 8.2 Vocabulary and Definitions
  • 8.3 The Graph Abstract Data Type
  • 8.4 An Adjacency Matrix
  • 8.5 An Adjacency List
  • 8.6 Implementation
  • 8.7 The Word Ladder Problem
  • 8.8 Building the Word Ladder Graph
  • 8.9 Implementing Breadth First Search
  • 8.10 Breadth First Search Analysis
  • 8.11 The Knight’s Tour Problem
  • 8.12 Building the Knight’s Tour Graph
  • 8.13 Implementing Knight’s Tour
  • 8.14 Knight’s Tour Analysis
  • 8.15 General Depth First Search
  • 8.16 Depth First Search Analysis
  • 8.17 Topological Sorting
  • 8.18 Strongly Connected Components
  • 8.19 Shortest Path Problems
  • 8.20 Dijkstra’s Algorithm
  • 8.21 Analysis of Dijkstra’s Algorithm
  • 8.22 Prim’s Spanning Tree Algorithm
  • 8.23 Summary
  • 8.24 Key Terms
  • 8.25 Discussion Questions
  • 8.26 Programming Exercises
  • 8.13. Implementing Knight’s Tour" data-toggle="tooltip">
  • 8.15. General Depth First Search' data-toggle="tooltip" >

8.14. Knight’s Tour Analysis ¶

There is one last interesting topic regarding the knight’s tour problem, then we will move on to the general version of the depth first search. The topic is performance. In particular, knightTour is very sensitive to the method you use to select the next vertex to visit. For example, on a five-by-five board you can produce a path in about 1.5 seconds on a reasonably fast computer. But what happens if you try an eight-by-eight board? In this case, depending on the speed of your computer, you may have to wait up to a half hour to get the results! The reason for this is that the knight’s tour problem as we have implemented it so far is an exponential algorithm of size \(O(k^N)\) , where N is the number of squares on the chess board, and k is a small constant. Figure 12 can help us visualize why this is so. The root of the tree represents the starting point of the search. From there the algorithm generates and checks each of the possible moves the knight can make. As we have noted before the number of moves possible depends on the position of the knight on the board. In the corners there are only two legal moves, on the squares adjacent to the corners there are three and in the middle of the board there are eight. Figure 13 shows the number of moves possible for each position on a board. At the next level of the tree there are once again between 2 and 8 possible next moves from the position we are currently exploring. The number of possible positions to examine corresponds to the number of nodes in the search tree.

../_images/8arrayTree.png

Figure 12: A Search Tree for the Knight’s Tour ¶

../_images/moveCount.png

Figure 13: Number of Possible Moves for Each Square ¶

We have already seen that the number of nodes in a binary tree of height N is \(2^{N+1}-1\) . For a tree with nodes that may have up to eight children instead of two the number of nodes is much larger. Because the branching factor of each node is variable, we could estimate the number of nodes using an average branching factor. The important thing to note is that this algorithm is exponential: \(k^{N+1}-1\) , where \(k\) is the average branching factor for the board. Let’s look at how rapidly this grows! For a board that is 5x5 the tree will be 25 levels deep, or N = 24 counting the first level as level 0. The average branching factor is \(k = 3.8\) So the number of nodes in the search tree is \(3.8^{25}-1\) or \(3.12 \times 10^{14}\) . For a 6x6 board, \(k = 4.4\) , there are \(1.5 \times 10^{23}\) nodes, and for a regular 8x8 chess board, \(k = 5.25\) , there are \(1.3 \times 10^{46}\) . Of course, since there are multiple solutions to the problem we won’t have to explore every single node, but the fractional part of the nodes we do have to explore is just a constant multiplier which does not change the exponential nature of the problem. We will leave it as an exercise for you to see if you can express \(k\) as a function of the board size.

Luckily there is a way to speed up the eight-by-eight case so that it runs in under one second. In the listing below we show the code that speeds up the knightTour . This function (see Listing 4 ), called orderbyAvail will be used in place of the call to u.getConnections in the code previously shown above. The critical line in the orderByAvail function is line 10. This line ensures that we select the vertex to go next that has the fewest available moves. You might think this is really counter productive; why not select the node that has the most available moves? You can try that approach easily by running the program yourself and inserting the line resList.reverse() right after the sort.

The problem with using the vertex with the most available moves as your next vertex on the path is that it tends to have the knight visit the middle squares early on in the tour. When this happens it is easy for the knight to get stranded on one side of the board where it cannot reach unvisited squares on the other side of the board. On the other hand, visiting the squares with the fewest available moves first pushes the knight to visit the squares around the edges of the board first. This ensures that the knight will visit the hard-to-reach corners early and can use the middle squares to hop across the board only when necessary. Utilizing this kind of knowledge to speed up an algorithm is called a heuristic. Humans use heuristics every day to help make decisions, heuristic searches are often used in the field of artificial intelligence. This particular heuristic is called Warnsdorff’s algorithm, named after H. C. Warnsdorff who published his idea in 1823.

Look Into Chess - improve your game

Chess videos, game analysis, chess theory and articles. Chess variants, sample games.

“The human element, the human flaw and the human nobility – those are the reasons that chess matches are won or lost.” – Viktor Korchnoi

Knight’s Tour: The famous mathematical problem

Chess is a game of strategy and foresight, demanding players to think several moves ahead to outmaneuver their opponents. Among the numerous puzzles and challenges that arise from the complexity of chess, the Knight’s Tour Problem stands out as a particularly fascinating conundrum. The Knight’s Tour is a puzzle that involves moving a knight on a chessboard in such a way that it visits each square exactly once.

The Knight’s Tour Problem is a mathematical challenge that revolves around finding a specific sequence of moves for a knight on a chessboard. It has become a popular problem assigned to computer science students, who are tasked with developing programs to solve it. The variations of the Knight’s Tour Problem go beyond the standard 8×8 chessboard, including different sizes and irregular, non-rectangular boards.

knight's tour 6x6 solution

If you’re looking to find your own solution to the Knight’s Tour Problem, there is a straightforward approach known as Warnsdorff’s rule . Warnsdorff’s rule serves as a heuristic for discovering a single knight’s tour. The rule dictates that the knight should always move to the square from which it will have the fewest possible subsequent moves. In this calculation, any moves that would revisit a square already visited are not counted. By adhering to Warnsdorff’s rule, you can systematically guide the knight across the chessboard and ultimately find a knight’s tour.

Modern computers have significantly contributed to the exploration of the Knight’s Tour Problem. Through advanced algorithms and computational power, researchers have been able to tackle larger chessboards and refine existing solutions. However, finding a general solution that works for all chessboard sizes remains elusive.

In conclusion, the Knight’s Tour Problem continues to captivate mathematicians, chess players, and computer scientists alike. Its unique combination of chess strategy, mathematical intricacy, and computational challenges makes it a fascinating puzzle to explore. While the search for a comprehensive solution is ongoing, the journey towards unraveling the mysteries of the Knight’s Tour Problem offers valuable insights into the world of mathematics, algorithms, and the boundless potential of human intellect.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

OCF Chess

Exploring the Knight’s Tour Problem

The Knight’s tour problem is an interesting and challenging puzzle that has fascinated mathematicians for centuries. The problem is to find a sequence of moves for a knight on a chessboard such that the knight visits every square exactly once. This problem has been studied since the 9th century, and has been the subject of much research and speculation.

One of the most interesting aspects of the Knight’s tour problem is that it is not always possible to find a solution. This is because the knight’s movement is constrained by the geometry of the chessboard, and some configurations simply do not allow for a complete tour. However, it has been proven that a Knight’s tour is always possible on a rectangular board whose smaller dimension is at least 5.

For any m x n board with m ≤ n, a Knight’s tour is always possible unless one or more of thee three conditions are met: m = 1 or 2. m = 3 and n = 3, 5, or 6. This means that for most standard chessboards, a Knight’s tour is possible.

However, there are some exceptions to this rule. For example, if a square is removed from the chessboard, it may no longer be possible to find a complete Knight’s tour. This is because the removal of a single square can disrupt the geometry of the chessboard in such a way that it becomes impossible to visit every square.

Despite these challenges, the Knight’s tour problem remains a popular puzzle among mathematicians and puzzle enthusiasts. It is a fascinating example of how mathematics can be used to explore complex problems in a structured and systematic way.

The Knight’s tour problem is an intriguing puzzle that continues to fascinate mathematicians and puzzle enthusiasts alike. While there are some situations where it may not be possible to find a complete tour, the problem remains a challenging and rewarding pursuit for those who enjoy puzzles and problem-solving.

Is The Knight’s Tour Possible?

The Knight’s Tour is possible on a rectangular board whose smaller dimension is at least 5. Additionally, for any m x n board with m ≤ n, a Knight’s Tour is always possible unless one of the following conditions are met: – m = 1 or 2 – m = 3 and n = 3, 5, or 6.

It is important to note that a Knight’s Tour is a sequence of moves made by a knight on a chessboard, where the knight visits every square exactly once. The proof of the existence of a Knight’s Tour on certain types of boards is a well-studied problem in mathematics.

knights tour

What Is The Knights Tour Theory?

The Knight’s tour theory is a problem in the field of mathematics and chess. The problem is to find a sequence of moves by a knight on a chessboard such that the knight visits every square exactly once. The knight is allowed to move two squares in one direction and one square in the perpendicular direction. The problem has been studied for centuries, and many different solutions have been proposed.

One of the main questions in the Knight’s tour theory is whether a knight’s tour exists for every possible starting position and board size. It has been proven that a knight’s tour exists on all chessboards with one square removed, except for some specific cases. For example, if the board size is even, or if the removed square is (i, j) with i + j odd, then a knight’s tour may not be possible.

Other specific cases whre a knight’s tour may not be possible include when the board size is 3 and any square other than the center square is removed, when the board size is 5, when the board size is 7 and any square other than square (2, 2) or (2, 6) is removed, and when the board size is 9 and a certain specific square is removed.

The Knight’s tour theory is a fascinating problem that has captured the imagination of mathematicians and chess players alike. It is a challenging problem that requires creative thinking and careful analysis, and it continues to be studied and explored by researchers today.

What Is The Knight’s Tour Problem?

The Knight’s Tour problem is a mathematical puzzle that requires a player to find a sequence of moves for a knight piece on a chessboard, such that the knight visits every square exactly once. In other words, the problem asks whethr a knight can move to every square on the chessboard without repeating any square. The knight is allowed to move only in an L-shaped pattern, i.e., two squares horizontally or vertically and then one square in the perpendicular direction. The problem has been studied for centuries and has fascinated mathematicians and chess players alike. It has many applications in computer science, such as in algorithm design and optimization. The Knight’s Tour problem is a classic example of a combinatorial optimization problem, and finding a solution to the problem requires a lot of creativity and strategic planning.

The Knight’s tour problem has been a topic of interest for mathematicians and chess enthusiasts for centuries. While the problem may seem simple at first glance, it presents a challenging puzzle that requires careful analysis and strategic thinking. Through the years, various algorithms and techniques have been developed to solve the problem, and it has been proven that a Knight’s tour is possible on crtain types of chessboards. However, some conditions must be met, and certain squares must not be removed for the tour to be achievable. Despite its difficulty, the Knight’s tour problem remains a fascinating and engaging puzzle that continues to capture the imagination of people from all walks of life.

Related posts:

Photo of author

Doug Barlow

The Knight’s Tour

The  knight’s tour problem  is the mathematical problem of finding a knight’s tour, and probably making knight the most interesting piece on the chess board. The knight visits every square exactly once, if the knight ends on a square that is one knight’s move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed; otherwise, it is open.

The knight’s tour problem is an instance of the more general Hamiltonian path problem in graph theory. The problem of finding a closed knight’s tour is similarly an instance of the Hamiltonian cycle problem. Unlike the general Hamiltonian path problem, the knight’s tour problem can be solved in linear time.

Hamiltonian Path Problem

knight's tour 6x6 solution

In Graph Theory, a graph is usually defined to be a collection of nodes or vertices and the set of edges which define which nodes are connected with each other. So we use a well known notation of representing a graph G = (V,E) where  V = { v 1 , v 2 , v 3 , … , v n }  and E = {(i, j)|i ∈ V and j ∈ V and i and j is connected}.

Hamiltonian Path is defined to be a single path that visits every node in the given graph, or a permutation of nodes in such a way that for every adjacent node in the permutation there is an edge defined in the graph. Notice that it does not make much sense in repeating the same paths. In order to avoid this repetition, we permute with |V| C 2 combinations of starting and ending vertices.

Simple way of solving the Hamiltonian Path problem would be to permutate all possible paths and see if edges exist on all the adjacent nodes in the permutation. If the graph is a complete graph, then naturally all generated permutations would quality as a Hamiltonian path.

For example. let us find a Hamiltonian path in graph G = (V,E) where V = {1,2,3,4} and E = {(1,2),(2,3),(3,4)}. Just by inspection, we can easily see that the Hamiltonian path exists in permutation 1234. The given algorithm will first generate the following permutations based on the combinations: 1342 1432 1243 1423 1234 1324 2143 2413 2134 2314 3124 3214

The number that has to be generated is ( |V| C 2 ) (|V| – 2)!

knight's tour 6x6 solution

Schwenk proved that for any  m  ×  n  board with  m  ≤  n , a closed knight’s tour is always possible  unless  one or more of these three conditions are met:

  • m  and  n  are both odd
  • m  = 1, 2, or 4
  • m  = 3 and  n  = 4, 6, or 8.

Cull and Conrad proved that on any rectangular board whose smaller dimension is at least 5, there is a (possibly open) knight’s tour.

Neural network solutions

The neural network is designed such that each legal knight’s move on the chessboard is represented by a neuron. Therefore, the network basically takes the shape of the  knight’s graph  over an n×n chess board. (A knight’s graph is simply the set of all knight moves on the board)

Each neuron can be either “active” or “inactive” (output of 1 or 0). If a neuron is active, it is considered part of the solution to the knight’s tour. Once the network is started, each active neuron is configured so that it reaches a “stable” state if and only if it has exactly two neighboring neurons that are also active (otherwise, the state of the neuron changes). When the entire network is stable, a solution is obtained. The complete transition rules are as follows:

knight's tour 6x6 solution

where t represents time (incrementing in discrete intervals), U(N i,j ) is the state of the neuron connecting square i to square j, V(N i,j ) is the output of the neuron from i to j, and G(N i,j ) is the set of “neighbors” of the neuron (all neurons that share a vertex with N i,j ).

Code For Knight’s Tour

The Knight's Tour

You May Also Like

The soul theorem, the recamán sequence, knot theory, leave a reply cancel reply.

Chess Life Online

  • Mission and Vision
  • Annual Reports
  • Complaints Procedures
  • Delegates Information
  • Executive Board
  • Staff/Contact Us
  • Requests for Proposals (RFP)
  • Job Postings
  • Guide to a Successful Chess Club
  • The Ratings System
  • New to National Events Guide
  • Safe Play Policy
  • How to Send an Email Blast
  • Guide to Scholastic Chess
  • Accessibility Guidelines
  • Our Initiative
  • Top 100 Lists
  • Olympiad Campaign
  • At-Risk Youth
  • Correspondence Chess
  • 2023-24 Scholastic Regulations
  • Scholastic Council Members
  • Chess Life Kids Online
  • Faces of US Chess
  • Our Heritage: Yearbook
  • Upcoming Events
  • Grants/Awards
  • Spectator Policy at Scholastics
  • Current Scholastic Regulations
  • Event Bidding
  • Official Rules
  • Plan Ahead Calendar
  • Grand Prix Information
  • Pan American Youth Championships
  • Pan Am Youth Champ
  • Irwin: Seniors (50+)
  • Denker: HS (9-12)
  • Haring: Girls (K-12)
  • Barber: MS (6-8)
  • Rockefeller: ES (K-5)
  • Weeramantry: Blitz
  • Player/Ratings Look-Up
  • Past Event Crosstables
  • Events Rated List
  • TD/Affiliate Support
  • Club/Affiliate Search
  • Rating System Algorithm
  • MSA/Ratings FAQ
  • Become a Member
  • Become an Affiliate
  • Redeem a Voucher
  • Benefactor Members
  • Membership Form PDF
  • Info for Members/Affiliates
  • Donor Bill of Rights
  • Giving Tuesday
  • Donate Online
  • Case for Support
  • At-Risk-Youth

Chess and Math: A Closer Look at the Knight's Tour

knight's tour 6x6 solution

  • April 2024 (28)
  • March 2024 (34)
  • February 2024 (25)
  • January 2024 (26)
  • December 2023 (29)
  • November 2023 (26)
  • October 2023 (38)
  • September 2023 (27)
  • August 2023 (37)
  • July 2023 (47)
  • June 2023 (33)
  • May 2023 (37)
  • April 2023 (45)
  • March 2023 (37)
  • February 2023 (28)
  • January 2023 (31)
  • December 2022 (23)
  • November 2022 (32)
  • October 2022 (31)
  • September 2022 (19)
  • August 2022 (39)
  • July 2022 (32)
  • June 2022 (35)
  • May 2022 (21)
  • April 2022 (31)
  • March 2022 (33)
  • February 2022 (21)
  • January 2022 (27)
  • December 2021 (36)
  • November 2021 (34)
  • October 2021 (25)
  • September 2021 (25)
  • August 2021 (41)
  • July 2021 (36)
  • June 2021 (29)
  • May 2021 (29)
  • April 2021 (31)
  • March 2021 (33)
  • February 2021 (28)
  • January 2021 (29)
  • December 2020 (38)
  • November 2020 (40)
  • October 2020 (41)
  • September 2020 (35)
  • August 2020 (38)
  • July 2020 (36)
  • June 2020 (46)
  • May 2020 (42)
  • April 2020 (37)
  • March 2020 (60)
  • February 2020 (39)
  • January 2020 (45)
  • December 2019 (36)
  • November 2019 (35)
  • October 2019 (42)
  • September 2019 (45)
  • August 2019 (56)
  • July 2019 (44)
  • June 2019 (35)
  • May 2019 (40)
  • April 2019 (48)
  • March 2019 (61)
  • February 2019 (39)
  • January 2019 (30)
  • December 2018 (29)
  • November 2018 (51)
  • October 2018 (45)
  • September 2018 (29)
  • August 2018 (49)
  • July 2018 (35)
  • June 2018 (31)
  • May 2018 (39)
  • April 2018 (31)
  • March 2018 (26)
  • February 2018 (33)
  • January 2018 (30)
  • December 2017 (26)
  • November 2017 (24)
  • October 2017 (30)
  • September 2017 (30)
  • August 2017 (32)
  • July 2017 (27)
  • June 2017 (32)
  • May 2017 (26)
  • April 2017 (37)
  • March 2017 (28)
  • February 2017 (30)
  • January 2017 (27)
  • December 2016 (29)
  • November 2016 (24)
  • October 2016 (32)
  • September 2016 (31)
  • August 2016 (27)
  • July 2016 (24)
  • June 2016 (26)
  • May 2016 (19)
  • April 2016 (30)
  • March 2016 (37)
  • February 2016 (27)
  • January 2016 (33)
  • December 2015 (25)
  • November 2015 (23)
  • October 2015 (16)
  • September 2015 (28)
  • August 2015 (28)
  • July 2015 (6)
  • June 2015 (1)
  • May 2015 (2)
  • April 2015 (1)
  • February 2015 (3)
  • January 2015 (1)
  • December 2014 (1)
  • July 2010 (1)
  • October 1991 (1)
  • August 1989 (1)
  • January 1988 (1)
  • December 1983 (1)

Announcements

  • 2024 Continental Senior (50+) Chess Championships »
  • US Chess to Host Town Hall for Tournament Directors on Sunday, May 5 »
  • The Herbert B. Jacklyn Program is Open For 2024-25 Submissions »
  • 2024 Scholar-Chessplayer Awards Announced: Six Players Honored at the 2024 National High School Championship »

US CHESS PRESS

knight's tour 6x6 solution

Using the Knight's Tour to impress

knight's tour 6x6 solution

It is the program of choice for anyone who loves the game and wants to know more about it. Start your personal success story with ChessBase and enjoy the game even more.

knight's tour 6x6 solution

ONLINE SHOP

Endgame essentials you need to know vol.1 & vol 2.

knight's tour 6x6 solution

In this video course, GM Surya Ganguly joins IM Sagar Shah and drawing from his colossal experience, shares some uncommon endgame wisdom. The material mostly features positions with rook against rook and a pawn, and starts by covering the fundamentals.

€69.90

How to exchange pieces

knight's tour 6x6 solution

Learn to master the right exchange! Let the German WGM Elisabeth Pähtz show you how to gain a strategic winning position by exchanging pieces of equal value or to safely convert material advantage into a win.

How to play the Sicilian Defence!

knight's tour 6x6 solution

The continuous stream of new ideas in the Sicilian makes 1..c5 the most popular answer to 1.e4. On this DVD I do give an introduction to the most important Sicilian systems.

knight's tour 6x6 solution

User   Password  

Not registered yet? Register

Opening Encyclopaedia 2024

knight's tour 6x6 solution

Anyone who seriously deals with openings cannot avoid the opening encyclopaedia. Whether beginner or grandmaster. The Opening Encyclopaedia is by far the most comprehensive chess theory work: over 1,463(!) theory articles offer a huge fund of ideas!

€149.90

A Supergrandmaster's Guide to Openings Vol.1: 1.e4

knight's tour 6x6 solution

This video course includes GM Anish Giri's deep insights and IM Sagar Shah's pertinent questions to the super GM. In Vol.1 all the openings after 1.e4 are covered.

€49.90

A Supergrandmaster's Guide to Openings Vol.2: 1.d4, 1.c4 and Sidelines

knight's tour 6x6 solution

This video course includes GM Anish Giri's deep insights and IM Sagar Shah's pertinent questions to the super GM. While Vol.1 dealt with 1.e4, Vol.2 has all the openings after 1.d4 as well as 1.c4 and sidelines are covered.

A Supergrandmaster's Guide to Openings Vol.1 & 2

knight's tour 6x6 solution

€89.90

The Sharp Arkhangelsk Variation in the Ruy Lopez

knight's tour 6x6 solution

Great players always have their own successful variations in the opening.

€35.90

ChessBase Magazine Extra 218

knight's tour 6x6 solution

Videos: Nico Zwirs on the Vienna Game (1.e4 e5 2.Nc3 Nf6 3.Bc4 Bc5 4.d3 c6 5.f4) and part 2 of “Mikhalchishins miniatures”. “Lucky bag” with 53 commented games by Romain Edouard, Michal Krasenkow, Samvel Ter-Sahakyan, Gabriel Sargissian, Nodirbek Yakubboe

€14.90

Master the Kalashnikov Sicilian

knight's tour 6x6 solution

Dive into the fascinating world of the Sicilian Kalashnikov variation! We will uncover the secrets of this explosive opening from the very first moves: 1.e4 c5 2.Nf3 Nc6 3.d4 cxd4 4.Nxd4 e5.

€34.90

Najdorf: A dynamic grandmaster repertoire against 1.e4 Vol.1 to 3

knight's tour 6x6 solution

In the first part of the video series, we will look at White’s four main moves: 6. Bg5, 6. Be3, 6. Be2 and 6. Bc4.

€99.90

Fritztrainer in App Store

knight's tour 6x6 solution

for iPads and iPhones

Pop-up for detailed settings

We use cookies and comparable technologies to provide certain functions, to improve the user experience and to offer interest-oriented content. Depending on their intended use, cookies may be used in addition to technically required cookies, analysis cookies and marketing cookies. You can decide which cookies to use by selecting the appropriate options below. Please note that your selection may affect the functionality of the service. Further information can be found in our privacy policy .

Knight's Tour

knight's tour 6x6 solution

  • Eight Queens
  • Uncrossed Knight's Path
  • Queen Domination
  • Three Kings

IMAGES

  1. Knights tour solved for 6x6 chessboard

    knight's tour 6x6 solution

  2. knight's tour problem 6x6 chessboard

    knight's tour 6x6 solution

  3. python

    knight's tour 6x6 solution

  4. hamiltonian path

    knight's tour 6x6 solution

  5. Knight's Tour » Linux Magazine

    knight's tour 6x6 solution

  6. Knight's Tour Problem

    knight's tour 6x6 solution

VIDEO

  1. A closed Knight's Tour

  2. Mã Đi Tuần

  3. King Arthur: Knight's Tale Part 6 (Very Hard) Gameplay Walkthrough

  4. TRAXXAS, short tour through the undergrowth part 2 / 2

  5. Star Wars

  6. TRAXXAS, short tour through the undergrowth part 1 / 2

COMMENTS

  1. Closed Knight's Tours of the 6 by 6 Board

    Catalogue of all Asymmetric Closed Knight's Tours of the 6×6 Board. Diagrams of all 1223 tours of this type are shown on the following catalogue pages. Asymmetric tours with 4 or 12 slants: Total 60 + 44 = 104. Asymmetric tours with 6 or 10 slants: Total 304 + 288 = 592. Asymmetric tours with 8 slants: Total 527.

  2. Knights tour solved for 6x6 chessboard

    Link to code: https://github.com/ironmaniiith/cool-stuffs/tree/master/knights-tourHappy Coding :D

  3. How I can shortly prove that you can have a closed knight's tour on the

    On the website, the explanation that a knight's tour on a $6\times6$ board is possible is the continued proof of around $1\frac{1}{2}$ pages! It will be great if one of you could provide a simple, concise proof that the $6\times6$ is possible.. After being asked this question I tried to formulate conjectures to try and prove that the 6x6 is possible by finding solutions based on rules that I ...

  4. knight's tour problem 6x6 chessboard

    The Knight's Tour is a mathematical problem involving a knight on a chessboard. The knight is placed on the empty board and, moving according to the rules of...

  5. The Knight's tour problem

    The Knight's tour problem. Backtracking is an algorithmic paradigm that tries different solutions until finds a solution that "works". Problems that are typically solved using the backtracking technique have the following property in common. These problems can only be solved by trying every possible configuration and each configuration is ...

  6. The Knight's Tour: Finding Some of its Solutions

    Figure 1: A Knight's Tour graph for a 5x5 board. We can break down the problem of the Knight's Tour into something more familiar for mathematicians. Imagine the chessboard as a graph with the squares as nodes and edges between nodes that are reachable within one knight's move. We can imagine our knight moving between nodes that have an ...

  7. 9.14. Knight's Tour Analysis

    For a 6x6 board, \(k = 4.4\), there are \(1.5 \times 10^{23}\) ... The visualization below depicts the full process of a Knight's Tour solution. It portrays the visitation of every spot on the chess board and an analysis on all neighboring locations, and finishes by showing the final solution wherein all locations on the chess board have been ...

  8. Knights-Tour

    Closed Knight's Tour Solution Key [Simple Solution] [Semi-Magic Square Knight Tours] [Knight's ... The code has solved all unique 6x6 closed knight tours (9862 total). I have included printouts on my web site of various other closed and symmetrical tours for smaller size boards. Anyway, check it out and see if you like the new stuff. Let me ...

  9. Some Closed Knight's Tours

    The following small knight's tour was used as part of the base of the recursion in a divide-and-conquer algorithm described in Ian Parberry, "An Efficient Algorithm for the Knight's Tour Problem", Discrete Applied Mathematics, Vol. 73, pp. 251-260, 1997.[]You may have noticed by now that all of the closed knight's tours you have seen so far (6x6, 8x8, and 10x10) have even sides.

  10. 8.14. Knight's Tour Analysis

    The average branching factor is k = 3.8 So the number of nodes in the search tree is 3.8 25 − 1 or 3.12 × 10 14. For a 6x6 board, k = 4.4, there are 1.5 × 10 23 nodes, and for a regular 8x8 chess board, k = 5.25, there are 1.3 × 10 46. Of course, since there are multiple solutions to the problem we won't have to explore every single node ...

  11. Knight's tour

    An open knight's tour of a chessboard An animation of an open knight's tour on a 5 × 5 board. A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square exactly once. If the knight ends on a square that is one knight's move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed ...

  12. Knight's Tour: The famous mathematical problem

    The Knight's Tour Problem is a mathematical challenge that revolves around finding a specific sequence of moves for a knight on a chessboard. It has become a popular problem assigned to computer science students, who are tasked with developing programs to solve it. The variations of the Knight's Tour Problem go beyond the standard 8×8 ...

  13. Exploring the Knight's Tour Problem

    The Knight's tour theory is a problem in the field of mathematics and chess. The problem is to find a sequence of moves by a knight on a chessboard such that the knight visits every square exactly once. The knight is allowed to move two squares in one direction and one square in the perpendicular direction.

  14. The Knight's Tour

    The knight's tour problem is the mathematical problem of finding a knight's tour, and probably making knight the most interesting piece on the chess board. The knight visits every square exactly once, if the knight ends on a square that is one knight's move from the beginning square (so that it could tour the board again immediately, following the same path), the tour is closed ...

  15. Chess and Math: A Closer Look at the Knight's Tour

    The following are two diagrams of knight's tours. The first is a diagram of a closed tour, and the second is an open tour (numbers are included in the second diagram to further illustrate the knight's movements): Many chess problems can be discussed quite nicely using techniques and terminology from 'graph theory' in mathematics. To put ...

  16. Optimizing Recursion in Knight's Tour

    It should count all possible open tours (i.e. the start and end fields are not the same) recursively on a chessboard depending on board size and starting field (as per assignment). If the size is less than 6x6, all of the solutions should be displayed in chess notation. It's actually working quite well for sizes smaller than 6.

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

    The Knight's tour is a chessboard. # which it visits every square on the board exactly one. It uses a 6x6 array for. # range of which both start at 0. Let the upper-left square of the board be the. # row 0 and column 0 square. # Imports the necessary modules. # Initializes the chessboard as a 6x6 array.

  18. PDF Knight's tours on boards with odd dimensions

    A closed knight's tour of a board consists of a sequence of knight moves, where each square is visited exactly once and the sequence begins and ends with the same square. For boards of size m n where m and n are odd, a tour is impossible because there are unequal numbers of white and black squares. By deleting a square, we can fix this ...

  19. Using the Knight's Tour to impress

    A "Knight's Tour" is a sequence of 64 knight moves executed in such a way that each square of the board is visited exactly once. The young lad was blindfolded and a starting square was called out to him. Without much thought he dictated a sequence of 64 squares that comprised a perfect knight tour. The reaction to this feat in Germany was ...

  20. Question about closed knight's tours for n x m chessboard

    $\begingroup$ The site you link has proofs of all board sizes. Certain smaller boards are proved impossible with various somewhat ad-hoc techniques, larger boards are proved possible by giving explicit solutions to some base cases and techniques for expanding those solutions to larger boards, mostly by bolting on 4xn sections until you reach the desired size.

  21. combinatorics

    The definition of a 'closed' knights tour on a m × n m × n board, is a sequence of steps from a starting square a1 a 1 to another square amn a m n , such that every square is visited exactly once, and the last sqaure is only one knight step away from a1 a 1. Having said that, it is obvious, that for mn m n (mod2) = 1 = 1, there exists no ...

  22. Knight's Tour

    The only restriction is that the knight cannot visit the same square twice. The puzzle is said to be completed if the knight visited all squares (i.e. 64 on a standard 8x8 board) on the board. The classic Knight's Tour problem can be extended to any board size (larger than 4). In this small game you can test nine different board size: 5x5, 6x6 ...