How to play four knights puzzle?

This puzzle is very easy to play. The goal is to swap the positions of black knights with the white ones with minimum number of moves. Therefore, at the end the black knights should be placed on the bottom row (in corner squares) whereas the white ones on the top row (in corner squares). The knight move is similar to the regular chess where a knight can make an "L" shape move.

*** You can download the source code for this game from my github repository four knights puzzle.

Language: HTML & JavaScript
Used technologies: PhoneGap & KinteicJS
No of lines: 273
Used data structures: Arrays