Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Knight's Tour on a 5 x 5 Board Start from any Square?

I'd just like to check my logic here...

I wrote code to solve the Knight's Tour and it works well for 8x8 boards starting the Knight at any square.

But... on a 5x5 board I show no solution possible when starting at square (0, 1).

What I tried for 5x5 starting the Knight at Row 0, Col 1:

  1. Warnsdorff's path
  2. Added Roth (tie breakers based on Euclidean distance from center).

Since those did not produce a solution I did code that is just basic recursion with backtracking to test every possible path -- also no solution found when starting a 5x5 on 1, 0.

I looked everywhere for a list of exhaustive solutions to the 5x5 board but found none.

Is it that there just is no solution for 5x5 when starting at square 0, 1?

Thank you!

like image 425
Matt M. Avatar asked Nov 22 '25 10:11

Matt M.


1 Answers

                             1   2   3   4     5

                          1 304  0   56   0    304

                          2  0   56   0   56    0

                          3  56  0   64   0    56

                          4  0   56    0  56   0

                          5 304   0   56   0   304

This might help.If knights starts at (1,1) there will be 304 possible knights tour and if it starts at (1,2) then there will be NO knights tour.Similarly if knight starts at (3,3) then there are 64 possible knights tour.

like image 106
Tejkiran Yabaku Avatar answered Nov 25 '25 11:11

Tejkiran Yabaku



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!