Lesson AB23 - Two-Dimensional Arrays |
|
|
Knight’s Tour 2 Background: Rather than trying a random approach to solve for the next move, we will develop an algorithm that uses some information and logic that we have about each square. As you played the game in Lab Assignment AB23.2, Knight’s Tour 1, you should have noticed that the edges were much more difficult to visit and the corners were the most difficult of all. If we analyze each square, we notice that some are more accessible than others. Here is an analysis of the accessibility of each square. A square with an accessibility of 8 means that it can be approached from 8 different other squares. A corner square is rated at 2, while the edges are rated at 3 or 4. It makes sense to try and visit squares with lower accessibility values first, leaving the more accessible middle squares for later in the algorithm. Assignment:
|
|