[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

1386.0. "A lone wondering knight." by HPSTEK::XIA (In my beginning is my end.) Tue Feb 12 1991 18:14

    Choose a square on the 8X8 chess board.  Place a knight on any square
    of your choice.  Design a plan that will move the knight around and to 
    every square on the board.  You are not allowed to step on the same 
    square twice.  
    
    Eugene
T.RTitleUserPersonal
Name
DateLines
1386.1GUESS::DERAMODan D'EramoTue Feb 12 1991 18:283
        I once wrote a FORTRAN program that did this.
        
        Dan
1386.2HPSTEK::XIAIn my beginning is my end.Tue Feb 12 1991 20:066
    re .1,
    
    I cooked up a recursive algorithm a while ago, but thought it would 
    take too long to run (something exponential comes to mind).
    
    Eugene
1386.3GUESS::DERAMODan D'EramoTue Feb 12 1991 20:266
        A heuristic that works is to move to the square, from
        which you can move to the square, from which you would
        have the fewest moves (where "move" means "legal move"
        i.e. not reached already).
        
        Dan
1386.4The Knight's Tour.CADSYS::COOPERTopher CooperTue Feb 12 1991 20:5729
    This is a classic problem going back centuries.  Its called the problem
    of the "Knight's Tour".  There are two major variants (with lots of
    minor ones, e.g., looking for tours with bilateral symetry), the open
    tour and the closed tour.  In the closed tour, you must return to your
    starting square.

    There are lots of heuristics that allow you to find *a* solution more
    quickly, with Dan's being one of the best.  There are also many
    techniques which allow you to avoid bad choices or back out of them
    quickly -- these make searching programs quite practical.  Here is
    one:

    Do your work on a single static chessboard data structure which records
    where you move from a given square if that has been decided, which
    squares are accesible with a knight's move (whether or not those
    squares are currently filled) and, for as yet unvisited squares, the
    number of unvisited squares accessible from that square.  Each
    recursively applied move should modify the data structure and then
    restore it before returning to the previous move.

    Anytime a square has an accessibility of two, it should be immediately
    connected to those two squares -- even though this may not connect
    (yet) to the continuous path.  If the accessibility of any square drops
    below 2, the last step should be backed out of.  (If an open knights
    tour is being done, some extra work must be done here).

    This results in a fairly practical program, with only moderate work.

				    Topher
1386.5GUESS::DERAMODan D'EramoWed Feb 13 1991 02:2410
	re .4,

>> with Dan's being one of the best.

        If you read the possessive there as suggesting I
        discovered it, well, I didn't. :-)  I remember reading
        about and implementing the heuristic, but it was in the
        late 70's and I have no recollection what the source was.

	Dan