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 (or re-entrant); otherwise, it is open.[1][2]

The knight's tour problem is the mathematical problem of finding a knight's tour. Creating a program to find a knight's tour is a common problem given to computer science students.[3] Variations of the knight's tour problem involve chessboards of different sizes than the usual 8 × 8, as well as irregular (non-rectangular) boards.

Theory

Knight's graph showing all possible paths for a knight's tour on a standard 8 × 8 chessboard. The numbers on each node indicate the number of possible moves that can be made from that position.

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.[4]

History

The knight's tour as solved by the Turk, a chess-playing machine hoax. This particular solution is closed (circular), and can thus be completed from any point on the board.

The earliest known reference to the knight's tour problem dates back to the 9th century AD. In Rudrata's Kavyalankara[5] (5.15), a Sanskrit work on Poetics, the pattern of a knight's tour on a half-board has been presented as an elaborate poetic figure (citra-alaṅkāra) called the turagapadabandha or 'arrangement in the steps of a horse'. The same verse in four lines of eight syllables each can be read from left to right or by following the path of the knight on tour. Since the Indic writing systems used for Sanskrit are syllabic, each syllable can be thought of as representing a square on a chessboard. Rudrata's example is as follows:

से ना ली ली ली ना ना ली
ली ना ना ना ना ली ली ली
ली ना ली ले ना ली ना
ली ली ली ना ना ना ना ली

transliterated:

se
na le

For example, the first line can be read from left to right or by moving from the first square to the second line, third syllable (2.3) and then to 1.5 to 2.7 to 4.8 to 3.6 to 4.4 to 3.2.

The Sri Vaishnava poet and philosopher Vedanta Desika, during the 14th century, in his 1,008-verse magnum opus praising the deity Ranganatha's divine sandals of Srirangam, Paduka Sahasram (in chapter 30: Chitra Paddhati) has composed two consecutive Sanskrit verses containing 32 letters each (in Anushtubh meter) where the second verse can be derived from the first verse by performing a Knight's tour on a 4 × 8 board, starting from the top-left corner.[6] The transliterated 19th verse is as follows:

sThi

(1)

rA

(30)

ga

(9)

sAm

(20)

sa

(3)

dhA

(24)

rA

(11)

dhyA

(26)

vi

(16)

ha

(19)

thA

(2)

ka

(29)

tha

(10)

thA

(27)

ma

(4)

thA

(23)

sa

(31)

thpA

(8)

dhu

(17)

kE

(14)

sa

(21)

rA

(6)

sA

(25)

mA

(12)

ran

(18)

ga

(15)

rA

(32)

ja

(7)

pa

(28)

dha

(13)

nna

(22)

ya

(5)

The 20th verse that can be obtained by performing Knight's tour on the above verse is as follows:

sThi thA sa ma ya rA ja thpA

ga tha rA mA dha kE ga vi |

dhu ran ha sAm sa nna thA dhA

sA dhyA thA pa ka rA sa rA ||

It is believed that Desika composed all 1,008 verses (including the special Chaturanga Turanga Padabandham mentioned above) in a single night as a challenge.[7]

A tour reported in the fifth book of Bhagavantabaskaraby by Bhat Nilakantha, a cyclopedic work in Sanskrit on ritual, law and politics, written either about 1600 or about 1700 describes three knight's tours. The tours are not only reentrant but also symmetrical, and the verses are based on the same tour, starting from different squares.[8] Nilakantha's work is an extraordinary achievement being a fully symmetric closed tour, predating the work of Euler (1759) by at least 60 years.

A semimagic square (its diagonals do not sum to its magic constant, 260) also forming a knight's tour – no fully magic tours exist on an 8x8 board (although they do exist on larger boards)[9]

After Nilakantha, one of the first mathematicians to investigate the knight's tour was Leonhard Euler. The first procedure for completing the knight's tour was Warnsdorf's rule, first described in 1823 by H. C. von Warnsdorf.

In the 20th century, the Oulipo group of writers used it, among many others. The most notable example is the 10 × 10 knight's tour which sets the order of the chapters in Georges Perec's novel Life a User's Manual.

The sixth game of the World Chess Championship 2010 between Viswanathan Anand and Veselin Topalov saw Anand making 13 consecutive knight moves (albeit using both knights); online commentators jested that Anand was trying to solve the knight's tour problem during the game.

Existence

A radially symmetric closed knight's tour

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

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

Cull et al. and Conrad et al. proved that on any rectangular board whose smaller dimension is at least 5, there is a (possibly open) knight's tour.[4][11] For any m × n board with mn, a knight's tour is always possible unless one or more of these three conditions are met:

  1. m = 1 or 2
  2. m = 3 and n = 3, 5, or 6[12]
  3. m = 4 and n = 4.[13]

Number of tours

On an 8 × 8 board, there are exactly 26,534,728,821,064 directed closed tours (i.e. two tours along the same path that travel in opposite directions are counted separately, as are rotations and reflections).[14][15][16] The number of undirected closed tours is half this number, since every tour can be traced in reverse. There are 9,862 undirected closed tours on a 6 × 6 board.[17]

n Number of directed tours (open and closed)
on an n × n board
(sequence A165134 in the OEIS)
1 1
2 0
3 0
4 0
5 1,728
6 6,637,920
7 165,575,218,320
8 19,591,828,170,979,904

Finding tours with computers

There are several ways to find a knight's tour on a given board with a computer. Some of these methods are algorithms, while others are heuristics.

Brute-force algorithms

A brute-force search for a knight's tour is impractical on all but the smallest boards.[18] On an 8 × 8 board, for instance, there are 13,267,364,410,532 knight's tours,[14] and a much greater number of sequences of knight moves of the same length. It is well beyond the capacity of modern computers (or networks of computers) to perform operations on such a large set. However, the size of this number is not indicative of the difficulty of the problem, which can be solved "by using human insight and ingenuity ... without much difficulty."[18]

By dividing the board into smaller pieces, constructing tours on each piece, and patching the pieces together, one can construct tours on most rectangular boards in linear time – that is, in a time proportional to the number of squares on the board.[11][19]

Warnsdorf's rule

abcdefgh
8
a6 three
c6 seven
d5 seven
b4 white knight
d3 seven
a2 two
c2 five
8
77
66
55
44
33
22
11
abcdefgh
A graphical representation of Warnsdorf's Rule. Each square contains an integer giving the number of moves that the knight could make from that square. In this case, the rule tells us to move to the square with the smallest integer in it, namely 2.
A very large (130 × 130) square open knight's tour created using Warnsdorf's Rule

Warnsdorf's rule is a heuristic for finding a single knight's tour. The knight is moved so that it always proceeds to the square from which the knight will have the fewest onward moves. When calculating the number of onward moves for each candidate square, we do not count moves that revisit any square already visited. It is possible to have two or more choices for which the number of onward moves is equal; there are various methods for breaking such ties, including one devised by Pohl[20] and another by Squirrel and Cull.[21]

This rule may also more generally be applied to any graph. In graph-theoretic terms, each move is made to the adjacent vertex with the least degree.[22] Although the Hamiltonian path problem is NP-hard in general, on many graphs that occur in practice this heuristic is able to successfully locate a solution in linear time.[20] The knight's tour is such a special case.[23]

The heuristic was first described in "Des Rösselsprungs einfachste und allgemeinste Lösung" by H. C. von Warnsdorf in 1823.[23]

A computer program that finds a knight's tour for any starting position using Warnsdorf's rule was written by Gordon Horsington and published in 1984 in the book Century/Acorn User Book of Computer Puzzles.[24]

Neural network solutions

Closed knight's tour on a 24 × 24 board solved by a neural network

The knight's tour problem also lends itself to being solved by a neural network implementation.[25] The network is set up such that every legal knight's move is represented by a neuron, and each neuron is initialized randomly to be either "active" or "inactive" (output of 1 or 0), with 1 implying that the neuron is part of the solution. Each neuron also has a state function (described below) which is initialized to 0.

When the network is allowed to run, each neuron can change its state and output based on the states and outputs of its neighbors (those exactly one knight's move away) according to the following transition rules:

where represents discrete intervals of time, is the state of the neuron connecting square to square , is the output of the neuron from to , and is the set of neighbors of the neuron.

Although divergent cases are possible, the network should eventually converge, which occurs when no neuron changes its state from time to . When the network converges, either the network encodes a knight's tour or a series of two or more independent circuits within the same board.

See also

Notes

  1. ^ Brown, Alfred James (2017). Knight's Tours and Zeta Functions (MS thesis). San José State University. p. 3. doi:10.31979/etd.e7ra-46ny.
  2. ^ Hooper, David; Whyld, Kenneth (1996) [First pub. 1992]. "knight's tour". The Oxford Companion to Chess (2nd ed.). Oxford University Press. p. 204. ISBN 0-19-280049-3.
  3. ^ Deitel, H. M.; Deitel, P. J. (2003). Java How To Program Fifth Edition (5th ed.). Prentice Hall. pp. 326–328. ISBN 978-0131016217.
  4. ^ a b Conrad, A.; Hindrichs, T.; Morsy, H. & Wegener, I. (1994). "Solution of the Knight's Hamiltonian Path Problem on Chessboards". Discrete Applied Mathematics. 50 (2): 125–134. doi:10.1016/0166-218X(92)00170-Q.
  5. ^ Satyadev, Chaudhary. Kavyalankara of Rudrata (Sanskrit text, with Hindi translation);. Delhitraversal: Parimal Sanskrit Series No. 30.
  6. ^ "Indian Institute of Information Technology, Bangalore". www.iiitb.ac.in. Retrieved 2019-10-11.
  7. ^ Bridge-india (2011-08-05). "Bridge-India: Paduka Sahasram by Vedanta Desika". Bridge-India. Retrieved 2019-10-16.
  8. ^ A History of Chess by Murray
  9. ^ "MathWorld News: There Are No Magic Knight's Tours on the Chessboard".
  10. ^ Allen J. Schwenk (1991). "Which Rectangular Chessboards Have a Knight's Tour?" (PDF). Mathematics Magazine. 64 (5): 325–332. doi:10.1080/0025570X.1991.11977627. S2CID 28726833. Archived from the original (PDF) on 2019-05-26.
  11. ^ a b Cull, P.; De Curtins, J. (1978). "Knight's Tour Revisited" (PDF). Fibonacci Quarterly. 16 (3): 276–285. doi:10.1080/00150517.1978.12430328. Archived (PDF) from the original on 2022-10-09.
  12. ^ "Knight's Tours on 3 by N Boards".
  13. ^ "Knight's Tours on 4 by N Boards".
  14. ^ a b Löbbing, Martin; Wegener, Ingo (1996). "The number of knight's tours equals 33,439,123,484,294—counting with binary decision diagrams". Electronic Journal of Combinatorics. 3 (1). Research Paper 5. doi:10.37236/1229. MR 1368332. See attached comment by Brendan McKay, Feb 18, 1997, for the corrected count.
  15. ^ Brendan McKay (1997). "Knight's Tours on an 8 × 8 Chessboard". Technical Report TR-CS-97-03. Department of Computer Science, Australian National University. Archived from the original on 2013-09-28. Retrieved 2013-09-22.
  16. ^ Wegener, I. (2000). Branching Programs and Binary Decision Diagrams. Society for Industrial & Applied Mathematics. ISBN 978-0-89871-458-6.
  17. ^ Weisstein, Eric W. "Knight Graph". MathWorld.
  18. ^ a b Simon, Dan (2013), Evolutionary Optimization Algorithms, John Wiley & Sons, pp. 449–450, ISBN 9781118659502, The knight's tour problem is a classic combinatorial optimization problem. ... The cardinality Nx of x (the size of the search space) is over 3.3×1013 (Löbbing and Wegener, 1995). We would not want to try to solve this problem using brute force, but by using human insight and ingenuity we can solve the knight's tour without much difficulty. We see that the cardinality of a combinatorial optimization problem is not necessarily indicative of its difficulty.
  19. ^ Parberry, Ian (1997). "An Efficient Algorithm for the Knight's Tour Problem" (PDF). Discrete Applied Mathematics. 73 (3): 251–260. doi:10.1016/S0166-218X(96)00010-8. Archived (PDF) from the original on 2022-10-09.
  20. ^ a b Pohl, Ira (July 1967). "A method for finding Hamilton paths and Knight's tours". Communications of the ACM. 10 (7): 446–449. CiteSeerX 10.1.1.412.8410. doi:10.1145/363427.363463. S2CID 14100648.
  21. ^ Squirrel, Douglas; Cull, P. (1996). "A Warnsdorff-Rule Algorithm for Knight's Tours on Square Boards" (PDF). GitHub. Retrieved 2011-08-21.
  22. ^ Van Horn, Gijs; Olij, Richard; Sleegers, Joeri; Van den Berg, Daan (2018). A Predictive Data Analytic for the Hardness of Hamiltonian Cycle Problem Instances (PDF). DATA ANALYTICS 2018: The Seventh International Conference on Data Analytics. Athens, greece: XPS. pp. 91–96. ISBN 978-1-61208-681-1. Retrieved 2018-11-27.
  23. ^ a b Alwan, Karla; Waters, K. (1992). Finding Re-entrant Knight's Tours on N-by-M Boards. ACM Southeast Regional Conference. New York, New York: ACM. pp. 377–382. doi:10.1145/503720.503806.
  24. ^ Dally, Simon, ed. (1984). Century/Acorn User Book of Computer Puzzles. Century Communications. ISBN 978-0712605410.
  25. ^ Y. Takefuji, K. C. Lee. "Neural network computing for knight's tour problems." Neurocomputing, 4(5):249–254, 1992.

Read other articles:

Kota Kovel bersama kota-kota kembarnya pada tahun 2009 Peta Ukraina Berikut ini adalah daftar tempat di Ukraina yang memiliki hubungan dengan komunitas daerah di negara lain. Hubungan ini disebut sebagai kota kembar. A Alchevsk[1][2][3] Dąbrowa Górnicza, Poland Dunaújváros, Hungary Feodosia, Ukraine Torez, Ukraine Alushta[4] Äänekoski, Finland Angarsk, Russia Capri, Italy Cassis, France Dubna, Russia Feodosia, Ukraine Georgiyevsk, Russia Krasnodon, Ukrain...

 

artikel ini perlu dirapikan agar memenuhi standar Wikipedia. Tidak ada alasan yang diberikan. Silakan kembangkan artikel ini semampu Anda. Merapikan artikel dapat dilakukan dengan wikifikasi atau membagi artikel ke paragraf-paragraf. Jika sudah dirapikan, silakan hapus templat ini. (Pelajari cara dan kapan saatnya untuk menghapus pesan templat ini) Hemotoraks Hemothoraks adalah kondisi yang terjadi ketika ada darah pada rongga pleura, yang terletak di antara dinding dada dan paru. Penumpukan ...

 

Isoprena Isoprena adalah nama umum (nama trivial) dari 2-metilbuta-1,3-diena. Senyawa ini biasa digunakan dalam industri, penyusun berbagai senyawa biologi penting, serta dapat berbahaya bagi lingkungan dan beracun bagi manusia bila terpapar secara berlebihan. Dalam suhu ruang isoprena berwujud cairan bening yang sangat mudah terbakar dan terpantik. Bila tercampur dengan udara sangat mudah meledak dan sangat reaktif bila dipanaskan. Pengangkutan isoprena memerlukan penanganan khusus. Secara i...

Universitas MelbourneArms of The University of MelbourneLatin: Universitas Melburnensiscode: la is deprecated MotoPostera Crescam LaudeWe grow in the esteem of future generationsJenisUniversitas negeriDidirikan1853Dana abadiA$1.129 billion (Desember 2009)KanselirAlex ChernovWakil KanselirGlyn DavisStaf akademik4,068 (2015)Jumlah mahasiswa45,411 (2015)Sarjana23,384 (2015)Magister18,417 (2015)LokasiParkville, Victoria, AustraliaKampusUrbanAfiliasiGroup of Eight, Universitas 21Situs webwww.uni...

 

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (مارس 2020) هذه المقالة عن التغير المناخي والصناعة والمجتمع الأنظمة والقطاعات الصحة يتعرض البشر لآثار التغير المناخي بصورة مباشرة من خلال أنماط طقسية متقلبة (كدرجات الح...

 

Artikel ini membahas mengenai bangunan, struktur, infrastruktur, atau kawasan terencana yang sedang dibangun atau akan segera selesai. Informasi di halaman ini bisa berubah setiap saat (tidak jarang perubahan yang besar) seiring dengan penyelesaiannya. Fortune AraamesInformasi umumStatusDisetujuiLokasiDubai, Uni Emirat ArabPerkiraan rampung2008Data teknisJumlah lantai45Desain dan konstruksiArsitekDimensions Engineering ConsultantsPengembangNakheel Fortune Araames merupakan sebuah menara berti...

British actress and centenarian Dame Gwen Ffrangcon-DaviesDBEGwen Ffrangcon-Davies, on 27 June 1928BornGwen Lucy Ffrangcon-Davies(1891-01-25)25 January 1891London, EnglandDied27 January 1992(1992-01-27) (aged 101)Halstead, Essex, EnglandResting placeSt Peter and St Thomas Churchyard, Stambourne, Essex, EnglandNationalityBritishOccupationActressYears active1911–1991Known forActress and centenarian Dame Gwen Lucy Ffrangcon-Davies, DBE (25 January 1891 – 27 January 1992) was a...

 

2020年夏季奥林匹克运动会科索沃代表團科索沃国旗IOC編碼KOSNOC科索沃奧林匹克委員會網站www.noc-kosovo.org(英文)(阿爾巴尼亞文)(塞爾維亞文)2020年夏季奥林匹克运动会(東京)2021年7月23日至8月8日(受2019冠状病毒病疫情影响推迟,但仍保留原定名称)運動員11參賽項目6个大项旗手开幕式:阿基爾·賈科瓦(英语:Akil Gjakova)和瑪琳達·開爾門蒂(柔道)[1]闭幕式�...

 

Earthquakes in 2021class=notpageimage| Approximate epicenters of the earthquakes in 2021 4.0–5.9 magnitude 6.0–6.9 magnitude 7.0–7.9 magnitude 8.0+ magnitude Strongest magnitude8.2 Mw United StatesDeadliest7.2 Mw Haiti 2,248 deathsTotal fatalities2,494Number by magnitude9.0+08.0–8.937.0–7.9166.0–6.91415.0–5.92,0464.0–4.914,643← 20202022 → This is a list of earthquakes in 2021. Only earthquakes of magnitude 6 or above are included, unless they resul...

Former Royal Air Force operations group No. 18 Group RAFRoyal Air Force EnsignActive1 April 1918 - 18 October 19191 September 1938 - 1 April 1996Country United KingdomBranch Royal Air ForceTypeRoyal Air Force groupPart ofRAF Coastal Command (1938 - 1969) RAF Strike Command (1969 - 1994)HeadquartersRAF Pitreavie CastleNorthwood HeadquartersMotto(s)Constant Endeavour[1]EngagementsWorld War I European theatre of World War II Battle of the Atlantic Military unit No. 18 Group (18...

 

Mexican theater of the Cold War, from 1964–1987 Mexican Dirty WarPart of the Cold War and Operation CondorMexican Army soldiers in the streets in 1968Date1964–1982[1][3]LocationMexicoResult Government victory Continued rule of the Institutional Revolutionary Party Most leftist guerrilla groups disbanded After the conflict Several acts of violence have not yet been clarified.[4] Political defeat of the PRI in the 2000 presidential elections before the National Actio...

 

Kronologi Alkitab adalah hasil penyusunan para pakar yang bermaksud mengkalibrasi berbagai silsilah dan catatan sejarah di dalam Alkitab Ibrani maupun Alkitab Kristen dengan sejarah umum. Sejumlah pakar Alkitab percaya bahwa dimungkinkan untuk mengurutkan kronologi tertentu sejarah umat manusia berdasarkan kepercayaan Yahudi dan Kristen.[1] Banyak pula peneliti yang menganggap hal itu sia-sia, misalnya David Long mengatakan bahwa upaya itu meletakkan dasar kreasionisme modern dengan m...

Municipality in State of Mexico, MexicoTezoyucaMunicipalityTezoyucaLocation in MexicoCoordinates: 19°45′11″N 99°11′15″W / 19.75306°N 99.18750°W / 19.75306; -99.18750Country MexicoStateState of MexicoMunicipal SeatTezoyucaArea • Total10.9 km2 (4.2 sq mi)Population (2005) • Total25,372Time zoneUTC-6 (Central Standard Time) • Summer (DST)UTC-5 (Central Daylight Time) Tezoyuca is a municipality in the...

 

Structure extending off of the Sun's surface Solar prominence seen in true color during totality of a Solar eclipse. In solar physics, a prominence, sometimes referred to as a filament,[a] is a large plasma and magnetic field structure extending outward from the Sun's surface, often in a loop shape. Prominences are anchored to the Sun's surface in the much brighter photosphere, and extend outwards into the solar corona. While the corona consists of extremely hot plasma, prominences co...

 

  لمعانٍ أخرى، طالع الخربة (توضيح). قرية الخربة  - قرية -  تقسيم إداري البلد  اليمن المحافظة محافظة صنعاء المديرية مديرية بني مطر العزلة عزلة ديان السكان التعداد السكاني 2004 السكان 380   • الذكور 213   • الإناث 167   • عدد الأسر 47   • عدد المساكن 34 معلوما�...

American public transit bus Motor vehicle GM New LookA GM New Look bus model T6H-5307N in service for the TTC (2008)OverviewManufacturerGM Truck and Bus (United States)GM Diesel Division (Canada)Production1959–1977 (U.S.)1962–1986 (Canada)[1]AssemblyPontiac, MichiganLondon, OntarioSaint-Eustache, QuebecBody and chassisClassTransit busBody styleMonocoque stressed-skinPowertrainEngine7.0 L (426 ci) Detroit Diesel 6V71 V6 diesel9.3 L (568 ci) Detroit Diesel 8V71 V8 die...

 

American college football season 1923 Washington Huskies footballRose Bowl, T 14–14 vs. NavyConferencePacific Coast ConferenceRecord10–1–1 (4–1 PCC)Head coachEnoch Bagshaw (3rd season)CaptainWayne HallHome stadiumHusky StadiumSeasons← 19221924 → 1923 Pacific Coast Conference football standings vte Conf Overall Team W   L   T W   L   T California $ 5 – 0 – 0 9 – 0 – 1 Washington^ 4 – 1 – 0 10 –...

 

1999–2000 concert tour by Bruce Springsteen and the E Street Band This article includes a list of references, related reading, or external links, but its sources remain unclear because it lacks inline citations. Please help improve this article by introducing more precise citations. (April 2024) (Learn how and when to remove this message) Bruce Springsteen and the E Street Band Reunion TourTour by Bruce Springsteen and the E Street BandStart dateApril 9, 1999End dateJuly 1, 2000Legs3No. of ...

Vật lý hạt nhân Nucleus • Nucleons (Proton, Neutron) • Lực hạt nhân • Phản ứng hạt nhân Mô hình hạt nhânGiọt chất lỏng • Mô hình vỏ hạt nhân • Mô hình boson tương tácPhương pháp theo nguyên lý đầu Phân loại hạt nhânĐồng vị – bằng ZIsobars – bằng NĐồng neutron – bằng NIsodiapher – bằng N − Z     Đồng phân – b�...

 

Seventh book of the Bible This article is about the biblical book. For other uses, see Judge (disambiguation). Judges in the Hebrew Bibleשופטים‎ Italics indicate individuals not explicitly described as judges Book of Exodus Moses Book of Joshua Joshua Book of Judges Othniel Ehud Shamgar Deborah Gideon Abimelech Tola Jair Jephthah Ibzan Elon Abdon Samson First Book of Samuel Eli Samuel vte Tanakh (Judaism) Torah (Instruction)GenesisBereshitExodusShemotLeviticusWayiqraNumbersBe...