Above is a board with 4 knights two white knights and two black knights. As in a standard game of chess, the knight can move only two steps in the horizontal or vertical direction and then one step in the other direction for one move. Define an action as moving a knight of any color.
The objective of the game is to interchange the position of both the black and white knights while alternately moving a knight of different color. The final state of the board is:
Using only actions, what is the minimum number of actions required to complete the game?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The difficulty of this problem is in clearly proving that you have indeed found the minimum number of actions. Let's rephrase this problem, so that we don't have to consider knight moves. Number the board in the following way:
Now, let's create a graph where the vertices are these squares, and the edges are the knigh-move adjacent squares that we can move to. We easily see that
1. The square 5 is not involved
2. We get a cycle (so simple!)
The original position is now expressed as such (where the 1 loops back on itself)
The final position that we want to get to, can be expressed as such:
Because we only have a cycle, and the knights do not "eat" each other, this implies that they can only move in one direction. As such, to minimize the number of actions, we must have each knight move 4 to the right (or left).
Thus, the minimal number of actions is 16.