SlideShare a Scribd company logo
Knight’s TourExplanation and Algorithms
GROUP MEMBERSHassan Tariq (2008-EE-180)ZairHussainWani (2008-EE-178)
Introduction
What is ‘Knight’s Tour’?Chess problem involving a knightStart on a random squareVisit each square exactly ONCE according to rulesTour called closed, if ending square is same as the starting
ConstraintsA closed knight’s tour is always possible on an m x n chessboard, unless: m and n are both odd, but not 1 m is either 1, 2 or 4 m = 3, and n is either 4, 6 or 8
m and n are both odd, but not 1
Knight moves either from black square to white, or vice versaIn closed tour knight visits even squaresIf m and n are odd i.e. 3x3,  total squares are odd so tour doesn`t exist
m = 1, 2, or 4; m and n are not both 1
for m = 1 or 2, knight will not be able to reach every squarefor m = 4, the alternate pattern of white and black square is not followed so tour not closed
m = 3; n = 4, 6, or 8
Have to be verified for each caseFor n > 8, existence of  closed tours can be proved by induction
AlgorithmsNeural Network SolutionsWarnsdorff’s Algorithm
Neural Network SolutionsEvery move represented by neuronEach neuron initialized to be active or inactive ( 1 or 0 )Each neuron having state function initialized to 0
Neural Network Solutions (contd.)Ut+1 (Ni,j) = Ut(Ni,j) +2 –    Vt(N)NG(Ni,j)                           1                Ut+1(Ni,j) > 3Vt+1(Ni,j) =    0                Ut+1(Ni,j) < 0Vt(Ni,j)       otherwise
Neural Network Solutions (contd.)The network ALWAYS convergeSolution: Closed knight’s tour
 Series of two or more open toursWarnsdorff's AlgorithmHeuristic MethodEach move made to the square from which no. of subsequent moves is least
Warnsdorff's Algorithm (contd.)Set P to be a random initial position on the boardMark the board at P with the move number "1" For each move number from 2 to the number of squares on the board:Let S be the set of positions accessible from the input position
Set P to be the position in S with minimum accessibility
Mark the board at P with the current move numberReturn the marked board – each square will be marked with the move number on which it is visited.

More Related Content

What's hot (20)

PPT
Directed Acyclic Graph
AJAL A J
 
PDF
AlphaGo in Depth
Mark Chang
 
PDF
Shortest path algorithms
Amit Kumar Rathi
 
PDF
Reinforcement Learning
CloudxLab
 
PPTX
Adversarial search with Game Playing
Aman Patel
 
PDF
AI simple search strategies
Renas Rekany
 
PPTX
Adversarial Search
Megha Sharma
 
PPTX
Fractional knapsack class 13
Kumar
 
PDF
Multi-armed Bandits
Dongmin Lee
 
PPTX
A* algorithm
Komal Samdariya
 
PPT
Artificial Intelligence -- Search Algorithms
Syed Ahmed
 
PDF
Heuristic search
Soheil Khodayari
 
PDF
Continuous control with deep reinforcement learning (DDPG)
Taehoon Kim
 
PPTX
Machine Learning - Convolutional Neural Network
Richard Kuo
 
PPT
Prim's Algorithm on minimum spanning tree
oneous
 
PPT
Backtracking
Vikas Sharma
 
PPTX
Hamilton path and euler path
Shakib Sarar Arnab
 
PPTX
Hill-climbing #2
Mohamed Gad
 
PPT
Finite automata
lavishka_anuj
 
PPTX
Adversarial search
Nilu Desai
 
Directed Acyclic Graph
AJAL A J
 
AlphaGo in Depth
Mark Chang
 
Shortest path algorithms
Amit Kumar Rathi
 
Reinforcement Learning
CloudxLab
 
Adversarial search with Game Playing
Aman Patel
 
AI simple search strategies
Renas Rekany
 
Adversarial Search
Megha Sharma
 
Fractional knapsack class 13
Kumar
 
Multi-armed Bandits
Dongmin Lee
 
A* algorithm
Komal Samdariya
 
Artificial Intelligence -- Search Algorithms
Syed Ahmed
 
Heuristic search
Soheil Khodayari
 
Continuous control with deep reinforcement learning (DDPG)
Taehoon Kim
 
Machine Learning - Convolutional Neural Network
Richard Kuo
 
Prim's Algorithm on minimum spanning tree
oneous
 
Backtracking
Vikas Sharma
 
Hamilton path and euler path
Shakib Sarar Arnab
 
Hill-climbing #2
Mohamed Gad
 
Finite automata
lavishka_anuj
 
Adversarial search
Nilu Desai
 

Viewers also liked (20)

DOCX
Chessboard Puzzles Part 3 - Knight's Tour
Dan Freeman
 
DOCX
Chessboard Puzzles Part 4 - Other Surfaces and Variations
Dan Freeman
 
PPTX
Chessboard Puzzles Part 2 - Independence
Dan Freeman
 
PPTX
Introduccion a prolog
JeffoG92
 
TXT
Prolog Code [Family Tree] by Shahzeb Pirzada
Shahzeb Pirzada
 
PPT
Ch10 Recursion
leminhvuong
 
PPT
Prolog programming
Harry Potter
 
PDF
ESTRATEGIA
LUPABUE34
 
PPTX
The Queen’s Movement
Milka Kusturica
 
DOCX
Chessboard Puzzles Part 1 - Domination
Dan Freeman
 
PDF
A biased random-key genetic algorithm for the Steiner triple covering problem
gomgcr
 
DOCX
Chessboard Puzzles Part 2 - Independence
Dan Freeman
 
PPTX
Chessboard Puzzles Part 1 - Domination
Dan Freeman
 
PPTX
Chessboard Puzzles Part 3 - Knight's Tour
Dan Freeman
 
PPT
Logic Programming and Prolog
Sadegh Dorri N.
 
PPTX
Introduction to graph theory (All chapter)
sobia1122
 
PDF
Chess camp 3. checkmates with many pieces
Nelson ruiz
 
PPT
Chaps 1-3-ai-prolog
juanpaperez1234
 
PPTX
Network &amp; graph theory
kalthoom almaqbali
 
PPTX
Graph theory short presentation
mjr989
 
Chessboard Puzzles Part 3 - Knight's Tour
Dan Freeman
 
Chessboard Puzzles Part 4 - Other Surfaces and Variations
Dan Freeman
 
Chessboard Puzzles Part 2 - Independence
Dan Freeman
 
Introduccion a prolog
JeffoG92
 
Prolog Code [Family Tree] by Shahzeb Pirzada
Shahzeb Pirzada
 
Ch10 Recursion
leminhvuong
 
Prolog programming
Harry Potter
 
ESTRATEGIA
LUPABUE34
 
The Queen’s Movement
Milka Kusturica
 
Chessboard Puzzles Part 1 - Domination
Dan Freeman
 
A biased random-key genetic algorithm for the Steiner triple covering problem
gomgcr
 
Chessboard Puzzles Part 2 - Independence
Dan Freeman
 
Chessboard Puzzles Part 1 - Domination
Dan Freeman
 
Chessboard Puzzles Part 3 - Knight's Tour
Dan Freeman
 
Logic Programming and Prolog
Sadegh Dorri N.
 
Introduction to graph theory (All chapter)
sobia1122
 
Chess camp 3. checkmates with many pieces
Nelson ruiz
 
Chaps 1-3-ai-prolog
juanpaperez1234
 
Network &amp; graph theory
kalthoom almaqbali
 
Graph theory short presentation
mjr989
 
Ad

Similar to Knight’s tour algorithm (20)

PDF
random walk lectures by p pj class notes
Fathima475342
 
PPT
order picking policies pick sequencing batching
agoyscepa
 
PPT
Order-Picking-Policies.ppt
TaspiyaAfroz
 
PPT
Shortest path
Ruchika Sinha
 
PPT
Circle drawing algo.
Mohd Arif
 
PPTX
Optimisation random graph presentation
Venkat Sai Sharath Mudhigonda
 
PDF
01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf
DKTaxation
 
PPTX
Knights tour on chessboard using backtracking
Abhishek Singh
 
PDF
Graph
Daniel Rivera
 
PDF
Graph
ssnetvnr
 
PPTX
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
varun arora
 
DOC
Unit 3 daa
Nv Thejaswini
 
PPT
rahul.ppt
ssuser46314b
 
PPTX
Lecture-13-CS345A-2023 of Design and Analysis
ssuser9183b6
 
PPTX
Stochastic Process Exam Help
Statistics Exam Help
 
PPTX
Stochastic Process Assignment Help
Statistics Assignment Help
 
PDF
2 cooper
Yandex
 
PDF
1. Random walk.pdf
Anjali Devi J S
 
PPTX
CSE680-07QuickSort.pptx
DeepakM509554
 
PPTX
EC8352-Signals and Systems - Laplace transform
NimithaSoman
 
random walk lectures by p pj class notes
Fathima475342
 
order picking policies pick sequencing batching
agoyscepa
 
Order-Picking-Policies.ppt
TaspiyaAfroz
 
Shortest path
Ruchika Sinha
 
Circle drawing algo.
Mohd Arif
 
Optimisation random graph presentation
Venkat Sai Sharath Mudhigonda
 
01-05-2023, SOL_DU_MBAFT_6202_Dijkstra’s Algorithm Dated 1st May 23.pdf
DKTaxation
 
Knights tour on chessboard using backtracking
Abhishek Singh
 
Graph
ssnetvnr
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
varun arora
 
Unit 3 daa
Nv Thejaswini
 
rahul.ppt
ssuser46314b
 
Lecture-13-CS345A-2023 of Design and Analysis
ssuser9183b6
 
Stochastic Process Exam Help
Statistics Exam Help
 
Stochastic Process Assignment Help
Statistics Assignment Help
 
2 cooper
Yandex
 
1. Random walk.pdf
Anjali Devi J S
 
CSE680-07QuickSort.pptx
DeepakM509554
 
EC8352-Signals and Systems - Laplace transform
NimithaSoman
 
Ad

Recently uploaded (20)

PPTX
Nutri-QUIZ-Bee-Elementary.pptx...................
ferdinandsanbuenaven
 
PPTX
Presentation: Climate Citizenship Digital Education
Karl Donert
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
PPTX
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
PDF
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
PPT on the Development of Education in the Victorian England
Beena E S
 
PPTX
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
PDF
The-Beginnings-of-Indian-Civilisation.pdf/6th class new ncert social/by k san...
Sandeep Swamy
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PPTX
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
PPTX
How to Configure Access Rights of Manufacturing Orders in Odoo 18 Manufacturing
Celine George
 
Nutri-QUIZ-Bee-Elementary.pptx...................
ferdinandsanbuenaven
 
Presentation: Climate Citizenship Digital Education
Karl Donert
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPT on the Development of Education in the Victorian England
Beena E S
 
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
The-Beginnings-of-Indian-Civilisation.pdf/6th class new ncert social/by k san...
Sandeep Swamy
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
community health nursing question paper 2.pdf
Prince kumar
 
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
How to Configure Access Rights of Manufacturing Orders in Odoo 18 Manufacturing
Celine George
 

Knight’s tour algorithm

  • 2. GROUP MEMBERSHassan Tariq (2008-EE-180)ZairHussainWani (2008-EE-178)
  • 4. What is ‘Knight’s Tour’?Chess problem involving a knightStart on a random squareVisit each square exactly ONCE according to rulesTour called closed, if ending square is same as the starting
  • 5. ConstraintsA closed knight’s tour is always possible on an m x n chessboard, unless: m and n are both odd, but not 1 m is either 1, 2 or 4 m = 3, and n is either 4, 6 or 8
  • 6. m and n are both odd, but not 1
  • 7. Knight moves either from black square to white, or vice versaIn closed tour knight visits even squaresIf m and n are odd i.e. 3x3, total squares are odd so tour doesn`t exist
  • 8. m = 1, 2, or 4; m and n are not both 1
  • 9. for m = 1 or 2, knight will not be able to reach every squarefor m = 4, the alternate pattern of white and black square is not followed so tour not closed
  • 10. m = 3; n = 4, 6, or 8
  • 11. Have to be verified for each caseFor n > 8, existence of closed tours can be proved by induction
  • 13. Neural Network SolutionsEvery move represented by neuronEach neuron initialized to be active or inactive ( 1 or 0 )Each neuron having state function initialized to 0
  • 14. Neural Network Solutions (contd.)Ut+1 (Ni,j) = Ut(Ni,j) +2 –  Vt(N)NG(Ni,j) 1 Ut+1(Ni,j) > 3Vt+1(Ni,j) = 0 Ut+1(Ni,j) < 0Vt(Ni,j) otherwise
  • 15. Neural Network Solutions (contd.)The network ALWAYS convergeSolution: Closed knight’s tour
  • 16. Series of two or more open toursWarnsdorff's AlgorithmHeuristic MethodEach move made to the square from which no. of subsequent moves is least
  • 17. Warnsdorff's Algorithm (contd.)Set P to be a random initial position on the boardMark the board at P with the move number "1" For each move number from 2 to the number of squares on the board:Let S be the set of positions accessible from the input position
  • 18. Set P to be the position in S with minimum accessibility
  • 19. Mark the board at P with the current move numberReturn the marked board – each square will be marked with the move number on which it is visited.
  • 20. ComparisonNeural networksWarnsdorff's Algorithm Complex algorithm (a lot of variables to be monitored)Longer run-timeNOT always gives a complete tourSimple algorithmLinear run-timeAlways gives a CLOSED tour