SlideShare a Scribd company logo
1 of 33
KNIGHT’S TOUR
By Sasank P
P V Sasank
13CS01007
Under the guidance of
Dr P L Bera
WHAT IS A KNIGHT’S TOUR PROBLEM?
 A knight’s tour problem is a mathematical problem involving a knight
on a chess board . The knight on the chess board is moved according
to the rules of chess.
 A knight's tour is a sequence of moves of a knight on a chessboard
such that the knight visits every square only once.
A KNIGHT’S TOUR LEGAL MOVES
PICTORIAL REPRESENTATION
 Knight’s tour can be represented as a graph.
 The vertices -Represent the squares of the board.
 The edges -Represent a knight’s legal moves between squares.
KNIGHT’S GRAPH
TYPES OF KNIGHT’S TOUR PROBLEMS
There are two types of problems:
1. Closed
2. Open
Knight’s tour
• Closed
• Open
If knight ends on a
square from which
the starting square
can be reached by
the knight , Then
that tour is a
closed one.
If the beginning
square cannot be
reached , Then
that tour is open.
OPEN KNIGHT’S TOUR PROBLEM
CLOSED KNIGHTS TOUR
VARIOUS ALGORITHMS
 Brute force search
 Divide and Conquer
 Warnsdorff’s rule
BRUTE FORCE SEARCH
 Very general problem solving technique.
 Iterates through all possible move sequences.
 For a regular 8x8 chess board, there are approximately
4×1051possible move sequences.
DIVIDE AND CONQUER
 Divide the board into smaller pieces.
 Construct tours on each piece.
 Patch all the pieces together.
WARNSDORFF’S ALGORITHM
 Introduced by H. C. Warnsdorff in 1823.
 Can be solved in linear time.
 Very efficient algorithm for solving knight’s tour.
WARNSDORFF’S ALGORITHM
 Some definitions:
 A position Q is accessible from a position P if P can move to Q by a single knight's
move, and Q has not yet been visited.
 The accessibility of a position P is the number of positions accessible from P.
 Algorithm:
1. set P to be a random initial position on the board
2. mark the board at P with the move number "1"
3. for each move number from 2 to the number of squares on the board:
I. let S be the set of positions accessible from the input position
II. set P to be the position in S with minimum accessibility
III. mark the board at P with the current move number
4.return the marked board :each square will be marked with the move number on
which it is visited.
WARNDROFF’S RULE PICTORIALLY:
SOLVING KNIGHT’S TOUR
 2-D array of 8x8 is created to represent a chessboard.
 Each element in the array is assumed to be a square on the board.
 Initially all the elements are assigned to 0 , to indicate that knight has
not visited any of these squares.
 Shift the knight from the initial input position to anyone of the possible
positions and assign the number of that move to element in that
position.
 If we could not find a tour , then shift the knight to any other of the
possible solutions. In this way check all the positions till you find a
solution.
C PROGRAM FOR SOLVING KNIGHT’S TOUR
 ..DownloadsstudiesSeminarknights mainnew.docx
OUTPUT:
SOLVING KNIGHT’S TOUR USING WARNSDROFF’S RULE
 ..DownloadsstudiesSeminarknights wandmainnew.docx
OUTPUT:
INTERESTING FACTS ON KNIGHT’S TOUR
 26,534,728,821,064 closed directed knight's tours are possible on 8x8
board.
 The exact number of open knight’s tours is not found yet.
 It’s estimated to be about 1015 to (2*1016).
MAGIC KNIGHT’S TOUR
 The squares of the chess board are numbered in the order of the
knight’s moves.
 Full magic knight’s tour:
Each column, row, and diagonal must sum to the same number.
 Magic knight’s tour:
Each column and row must sum to the same number.
 Existence of full magic knight’s tour on 8x8 was a 150-year-old
unsolved problem.
 In August 5, 2003, after nearly 62 computation-days, a search
showed that no 8x8 fully magic knight’s tour is possible
KNIGHT’S TOURS AND CRYPTOGRAPHY
 A cryptotour is a puzzle in which the 64 words or syllables of a verse
are printed on the squares of a chessboard and are to be read in the
sequence of a knight’s tour.
 Knight’s tour is simply an instance of Hamiltonian path.
 A closed tour is a Hamiltonian cycle.
 Knight's tour problem can be solved in linear time.
CONCLUSION
 Warnsdroff’s rule is the best and efficient method to solve a knight’s
tour.
 Warnsdroff’s rule gives always a closed tour.
 Proficient usage of Data structures and the user interface help us to
code and understand the tour easily.
OUTPUT:
GRAPHICAL DISPLAY
THANK YOU
Q&A

More Related Content

What's hot

Liner algebra-vector space-1 introduction to vector space and subspace
Liner algebra-vector space-1   introduction to vector space and subspace Liner algebra-vector space-1   introduction to vector space and subspace
Liner algebra-vector space-1 introduction to vector space and subspace Manikanta satyala
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm sachin varun
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen ProblemSukrit Gupta
 
Lecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmLecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmHema Kashyap
 
Daa:Dynamic Programing
Daa:Dynamic ProgramingDaa:Dynamic Programing
Daa:Dynamic Programingrupali_2bonde
 
implementation of travelling salesman problem with complexity ppt
implementation of travelling salesman problem with complexity pptimplementation of travelling salesman problem with complexity ppt
implementation of travelling salesman problem with complexity pptAntaraBhattacharya12
 
Knapsack problem algorithm, greedy algorithm
Knapsack problem algorithm, greedy algorithmKnapsack problem algorithm, greedy algorithm
Knapsack problem algorithm, greedy algorithmHoneyChintal
 
My Lecture Notes from Linear Algebra
My Lecture Notes fromLinear AlgebraMy Lecture Notes fromLinear Algebra
My Lecture Notes from Linear AlgebraPaul R. Martin
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problemJayesh Chauhan
 

What's hot (20)

Liner algebra-vector space-1 introduction to vector space and subspace
Liner algebra-vector space-1   introduction to vector space and subspace Liner algebra-vector space-1   introduction to vector space and subspace
Liner algebra-vector space-1 introduction to vector space and subspace
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Eigen value and vectors
Eigen value and vectorsEigen value and vectors
Eigen value and vectors
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen Problem
 
Rai practical presentations.
Rai practical presentations.Rai practical presentations.
Rai practical presentations.
 
Lecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmLecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithm
 
Daa:Dynamic Programing
Daa:Dynamic ProgramingDaa:Dynamic Programing
Daa:Dynamic Programing
 
implementation of travelling salesman problem with complexity ppt
implementation of travelling salesman problem with complexity pptimplementation of travelling salesman problem with complexity ppt
implementation of travelling salesman problem with complexity ppt
 
N queen puzzle
N queen puzzleN queen puzzle
N queen puzzle
 
Prim's algorithm
Prim's algorithmPrim's algorithm
Prim's algorithm
 
Knapsack problem
Knapsack problemKnapsack problem
Knapsack problem
 
Knapsack problem algorithm, greedy algorithm
Knapsack problem algorithm, greedy algorithmKnapsack problem algorithm, greedy algorithm
Knapsack problem algorithm, greedy algorithm
 
My Lecture Notes from Linear Algebra
My Lecture Notes fromLinear AlgebraMy Lecture Notes fromLinear Algebra
My Lecture Notes from Linear Algebra
 
8 queens problem using ga
8 queens problem using ga8 queens problem using ga
8 queens problem using ga
 
Strongly connected components
Strongly connected componentsStrongly connected components
Strongly connected components
 
Shortest path algorithms
Shortest path algorithmsShortest path algorithms
Shortest path algorithms
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
 
tic-tac-toe: Game playing
 tic-tac-toe: Game playing tic-tac-toe: Game playing
tic-tac-toe: Game playing
 
Propositional Logic and Pridicate logic
Propositional Logic and Pridicate logicPropositional Logic and Pridicate logic
Propositional Logic and Pridicate logic
 

Viewers also liked

Chessboard Puzzles Part 3 - Knight's Tour
Chessboard Puzzles Part 3 - Knight's TourChessboard Puzzles Part 3 - Knight's Tour
Chessboard Puzzles Part 3 - Knight's TourDan Freeman
 
Chessboard Puzzles Part 4 - Other Surfaces and Variations
Chessboard Puzzles Part 4 - Other Surfaces and VariationsChessboard Puzzles Part 4 - Other Surfaces and Variations
Chessboard Puzzles Part 4 - Other Surfaces and VariationsDan Freeman
 
Chessboard Puzzles Part 2 - Independence
Chessboard Puzzles Part 2 - IndependenceChessboard Puzzles Part 2 - Independence
Chessboard Puzzles Part 2 - IndependenceDan Freeman
 
Chessboard Puzzles Part 1 - Domination
Chessboard Puzzles Part 1 - DominationChessboard Puzzles Part 1 - Domination
Chessboard Puzzles Part 1 - DominationDan Freeman
 
Chessboard Puzzles Part 2 - Independence
Chessboard Puzzles Part 2 - IndependenceChessboard Puzzles Part 2 - Independence
Chessboard Puzzles Part 2 - IndependenceDan Freeman
 
A biased random-key genetic algorithm for the Steiner triple covering problem
A biased random-key genetic algorithm for the Steiner triple covering problemA biased random-key genetic algorithm for the Steiner triple covering problem
A biased random-key genetic algorithm for the Steiner triple covering problemgomgcr
 
Chessboard Puzzles Part 1 - Domination
Chessboard Puzzles Part 1 - DominationChessboard Puzzles Part 1 - Domination
Chessboard Puzzles Part 1 - DominationDan Freeman
 
Chessboard Puzzles Part 3 - Knight's Tour
Chessboard Puzzles Part 3 - Knight's TourChessboard Puzzles Part 3 - Knight's Tour
Chessboard Puzzles Part 3 - Knight's TourDan Freeman
 
Introduction to graph theory (All chapter)
Introduction to graph theory (All chapter)Introduction to graph theory (All chapter)
Introduction to graph theory (All chapter)sobia1122
 
Chess camp 3. checkmates with many pieces
Chess camp 3. checkmates with many piecesChess camp 3. checkmates with many pieces
Chess camp 3. checkmates with many piecesNelson ruiz
 
Graph theory short presentation
Graph theory short presentationGraph theory short presentation
Graph theory short presentationmjr989
 
Management of Tremor
Management of Tremor Management of Tremor
Management of Tremor PS Deb
 
Queue- 8 Queen
Queue- 8 QueenQueue- 8 Queen
Queue- 8 QueenHa Ninh
 
Los Angeles Lakers tops, Miami Heat and Chicago Bulls follow as the most soci...
Los Angeles Lakers tops, Miami Heat and Chicago Bulls follow as the most soci...Los Angeles Lakers tops, Miami Heat and Chicago Bulls follow as the most soci...
Los Angeles Lakers tops, Miami Heat and Chicago Bulls follow as the most soci...Simplify360
 
backtracking algorithms of ada
backtracking algorithms of adabacktracking algorithms of ada
backtracking algorithms of adaSahil Kumar
 

Viewers also liked (20)

Knight's Tour
Knight's TourKnight's Tour
Knight's Tour
 
Chessboard Puzzles Part 3 - Knight's Tour
Chessboard Puzzles Part 3 - Knight's TourChessboard Puzzles Part 3 - Knight's Tour
Chessboard Puzzles Part 3 - Knight's Tour
 
Chessboard Puzzles Part 4 - Other Surfaces and Variations
Chessboard Puzzles Part 4 - Other Surfaces and VariationsChessboard Puzzles Part 4 - Other Surfaces and Variations
Chessboard Puzzles Part 4 - Other Surfaces and Variations
 
Chessboard Puzzles Part 2 - Independence
Chessboard Puzzles Part 2 - IndependenceChessboard Puzzles Part 2 - Independence
Chessboard Puzzles Part 2 - Independence
 
ESTRATEGIA
ESTRATEGIAESTRATEGIA
ESTRATEGIA
 
The Queen’s Movement
The Queen’s MovementThe Queen’s Movement
The Queen’s Movement
 
Chessboard Puzzles Part 1 - Domination
Chessboard Puzzles Part 1 - DominationChessboard Puzzles Part 1 - Domination
Chessboard Puzzles Part 1 - Domination
 
Chessboard Puzzles Part 2 - Independence
Chessboard Puzzles Part 2 - IndependenceChessboard Puzzles Part 2 - Independence
Chessboard Puzzles Part 2 - Independence
 
A biased random-key genetic algorithm for the Steiner triple covering problem
A biased random-key genetic algorithm for the Steiner triple covering problemA biased random-key genetic algorithm for the Steiner triple covering problem
A biased random-key genetic algorithm for the Steiner triple covering problem
 
Chessboard Puzzles Part 1 - Domination
Chessboard Puzzles Part 1 - DominationChessboard Puzzles Part 1 - Domination
Chessboard Puzzles Part 1 - Domination
 
Chessboard Puzzles Part 3 - Knight's Tour
Chessboard Puzzles Part 3 - Knight's TourChessboard Puzzles Part 3 - Knight's Tour
Chessboard Puzzles Part 3 - Knight's Tour
 
Introduction to graph theory (All chapter)
Introduction to graph theory (All chapter)Introduction to graph theory (All chapter)
Introduction to graph theory (All chapter)
 
Chess camp 3. checkmates with many pieces
Chess camp 3. checkmates with many piecesChess camp 3. checkmates with many pieces
Chess camp 3. checkmates with many pieces
 
Network & graph theory
Network & graph theoryNetwork & graph theory
Network & graph theory
 
Graph theory short presentation
Graph theory short presentationGraph theory short presentation
Graph theory short presentation
 
Management of Tremor
Management of Tremor Management of Tremor
Management of Tremor
 
Queue- 8 Queen
Queue- 8 QueenQueue- 8 Queen
Queue- 8 Queen
 
Los Angeles Lakers tops, Miami Heat and Chicago Bulls follow as the most soci...
Los Angeles Lakers tops, Miami Heat and Chicago Bulls follow as the most soci...Los Angeles Lakers tops, Miami Heat and Chicago Bulls follow as the most soci...
Los Angeles Lakers tops, Miami Heat and Chicago Bulls follow as the most soci...
 
Tremors
TremorsTremors
Tremors
 
backtracking algorithms of ada
backtracking algorithms of adabacktracking algorithms of ada
backtracking algorithms of ada
 

Recently uploaded

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Recently uploaded (20)

Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 

Knights tour

  • 1. KNIGHT’S TOUR By Sasank P P V Sasank 13CS01007 Under the guidance of Dr P L Bera
  • 2. WHAT IS A KNIGHT’S TOUR PROBLEM?  A knight’s tour problem is a mathematical problem involving a knight on a chess board . The knight on the chess board is moved according to the rules of chess.  A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once.
  • 3. A KNIGHT’S TOUR LEGAL MOVES
  • 5.  Knight’s tour can be represented as a graph.  The vertices -Represent the squares of the board.  The edges -Represent a knight’s legal moves between squares.
  • 7. TYPES OF KNIGHT’S TOUR PROBLEMS There are two types of problems: 1. Closed 2. Open
  • 8. Knight’s tour • Closed • Open If knight ends on a square from which the starting square can be reached by the knight , Then that tour is a closed one. If the beginning square cannot be reached , Then that tour is open.
  • 11. VARIOUS ALGORITHMS  Brute force search  Divide and Conquer  Warnsdorff’s rule
  • 12. BRUTE FORCE SEARCH  Very general problem solving technique.  Iterates through all possible move sequences.  For a regular 8x8 chess board, there are approximately 4×1051possible move sequences.
  • 13.
  • 14. DIVIDE AND CONQUER  Divide the board into smaller pieces.  Construct tours on each piece.  Patch all the pieces together.
  • 15. WARNSDORFF’S ALGORITHM  Introduced by H. C. Warnsdorff in 1823.  Can be solved in linear time.  Very efficient algorithm for solving knight’s tour.
  • 16. WARNSDORFF’S ALGORITHM  Some definitions:  A position Q is accessible from a position P if P can move to Q by a single knight's move, and Q has not yet been visited.  The accessibility of a position P is the number of positions accessible from P.  Algorithm: 1. set P to be a random initial position on the board 2. mark the board at P with the move number "1" 3. for each move number from 2 to the number of squares on the board: I. let S be the set of positions accessible from the input position II. set P to be the position in S with minimum accessibility III. mark the board at P with the current move number 4.return the marked board :each square will be marked with the move number on which it is visited.
  • 18. SOLVING KNIGHT’S TOUR  2-D array of 8x8 is created to represent a chessboard.  Each element in the array is assumed to be a square on the board.  Initially all the elements are assigned to 0 , to indicate that knight has not visited any of these squares.  Shift the knight from the initial input position to anyone of the possible positions and assign the number of that move to element in that position.  If we could not find a tour , then shift the knight to any other of the possible solutions. In this way check all the positions till you find a solution.
  • 19. C PROGRAM FOR SOLVING KNIGHT’S TOUR  ..DownloadsstudiesSeminarknights mainnew.docx
  • 21. SOLVING KNIGHT’S TOUR USING WARNSDROFF’S RULE  ..DownloadsstudiesSeminarknights wandmainnew.docx
  • 23. INTERESTING FACTS ON KNIGHT’S TOUR  26,534,728,821,064 closed directed knight's tours are possible on 8x8 board.  The exact number of open knight’s tours is not found yet.  It’s estimated to be about 1015 to (2*1016).
  • 24. MAGIC KNIGHT’S TOUR  The squares of the chess board are numbered in the order of the knight’s moves.  Full magic knight’s tour: Each column, row, and diagonal must sum to the same number.  Magic knight’s tour: Each column and row must sum to the same number.
  • 25.
  • 26.  Existence of full magic knight’s tour on 8x8 was a 150-year-old unsolved problem.  In August 5, 2003, after nearly 62 computation-days, a search showed that no 8x8 fully magic knight’s tour is possible
  • 27. KNIGHT’S TOURS AND CRYPTOGRAPHY  A cryptotour is a puzzle in which the 64 words or syllables of a verse are printed on the squares of a chessboard and are to be read in the sequence of a knight’s tour.
  • 28.  Knight’s tour is simply an instance of Hamiltonian path.  A closed tour is a Hamiltonian cycle.  Knight's tour problem can be solved in linear time.
  • 29. CONCLUSION  Warnsdroff’s rule is the best and efficient method to solve a knight’s tour.  Warnsdroff’s rule gives always a closed tour.  Proficient usage of Data structures and the user interface help us to code and understand the tour easily.
  • 32.