SlideShare a Scribd company logo
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

Euler graph
Euler graphEuler graph
Euler graph
AAQIB PARREY
 
Graph Algorithms: Breadth-First Search (BFS)
Graph Algorithms: Breadth-First Search (BFS)Graph Algorithms: Breadth-First Search (BFS)
Graph Algorithms: Breadth-First Search (BFS)
Md. Shafiuzzaman Hira
 
Security of RSA and Integer Factorization
Security of RSA and Integer FactorizationSecurity of RSA and Integer Factorization
Security of RSA and Integer Factorization
Dharmalingam Ganesan
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
Ashikapokiya12345
 
A Star Search
A Star SearchA Star Search
Search problems in Artificial Intelligence
Search problems in Artificial IntelligenceSearch problems in Artificial Intelligence
Search problems in Artificial Intelligence
ananth
 
Floyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - MalingaFloyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - Malinga
Malinga Perera
 
Rooted & binary tree
Rooted & binary treeRooted & binary tree
Rooted & binary tree
MANISH T I
 
Homomorphic Encryption
Homomorphic EncryptionHomomorphic Encryption
Homomorphic Encryption
Victor Pereira
 
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
 
weak slot and filler
weak slot and fillerweak slot and filler
8 queen problem
8 queen problem8 queen problem
8 queen problem
NagajothiN1
 
Back patching
Back patchingBack patching
Back patching
santhiya thavanthi
 
Computer Security Lecture 7: RSA
Computer Security Lecture 7: RSAComputer Security Lecture 7: RSA
Computer Security Lecture 7: RSA
Mohamed Loey
 
Fractional knapsack class 13
Fractional knapsack class 13Fractional knapsack class 13
Fractional knapsack class 13Kumar
 
Aho corasick-lecture
Aho corasick-lectureAho corasick-lecture
Aho corasick-lecture
PekkaKilpelinen2
 
Introduction to Modular Arithmetic
Introduction to  Modular ArithmeticIntroduction to  Modular Arithmetic
Introduction to Modular Arithmetic
EFREN ARCHIDE
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
vikas dhakane
 

What's hot (20)

Graphs Algorithms
Graphs AlgorithmsGraphs Algorithms
Graphs Algorithms
 
Euler graph
Euler graphEuler graph
Euler graph
 
Graph Algorithms: Breadth-First Search (BFS)
Graph Algorithms: Breadth-First Search (BFS)Graph Algorithms: Breadth-First Search (BFS)
Graph Algorithms: Breadth-First Search (BFS)
 
Security of RSA and Integer Factorization
Security of RSA and Integer FactorizationSecurity of RSA and Integer Factorization
Security of RSA and Integer Factorization
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
 
A Star Search
A Star SearchA Star Search
A Star Search
 
Search problems in Artificial Intelligence
Search problems in Artificial IntelligenceSearch problems in Artificial Intelligence
Search problems in Artificial Intelligence
 
Floyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - MalingaFloyd Warshall algorithm easy way to compute - Malinga
Floyd Warshall algorithm easy way to compute - Malinga
 
Rooted & binary tree
Rooted & binary treeRooted & binary tree
Rooted & binary tree
 
Homomorphic Encryption
Homomorphic EncryptionHomomorphic Encryption
Homomorphic Encryption
 
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
 
weak slot and filler
weak slot and fillerweak slot and filler
weak slot and filler
 
8 queen problem
8 queen problem8 queen problem
8 queen problem
 
Back patching
Back patchingBack patching
Back patching
 
Computer Security Lecture 7: RSA
Computer Security Lecture 7: RSAComputer Security Lecture 7: RSA
Computer Security Lecture 7: RSA
 
Chap4
Chap4Chap4
Chap4
 
Fractional knapsack class 13
Fractional knapsack class 13Fractional knapsack class 13
Fractional knapsack class 13
 
Aho corasick-lecture
Aho corasick-lectureAho corasick-lecture
Aho corasick-lecture
 
Introduction to Modular Arithmetic
Introduction to  Modular ArithmeticIntroduction to  Modular Arithmetic
Introduction to Modular Arithmetic
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
 

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 problem
gomgcr
 
Chessboard Puzzles Part 1 - Domination
Chessboard Puzzles Part 1 - DominationChessboard Puzzles Part 1 - Domination
Chessboard Puzzles Part 1 - DominationDan 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 pieces
Nelson ruiz
 
Network & graph theory
Network & graph theoryNetwork & graph theory
Network & graph theory
kalthoom almaqbali
 
Graph theory short presentation
Graph theory short presentationGraph theory short presentation
Graph theory short presentation
mjr989
 
Management of Tremor
Management of Tremor Management of Tremor
Management of Tremor
PS Deb
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen Problem
Sukrit Gupta
 
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
 
Tremors
TremorsTremors
Tremors
NeurologyKota
 
backtracking algorithms of ada
backtracking algorithms of adabacktracking algorithms of ada
backtracking algorithms of ada
Sahil Kumar
 
Movement disorders lecture
Movement disorders lectureMovement disorders lecture
Movement disorders lecture
test
 

Viewers also liked (20)

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
 
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
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen Problem
 
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
 
Movement disorders lecture
Movement disorders lectureMovement disorders lecture
Movement disorders lecture
 

Recently uploaded

The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 

Recently uploaded (20)

The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 

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.