The Chess Homework Solution.

ChessSolution.java The source code