Update AIsolver.java

There is a bug in the Java code, Board.action method.
Random cell can only be added after a valid move. But in the Board.action method, random cell is added even for an invalid move.

For example,
Let the board be 
0 0 0 4
0 0 0 0
0 0 0 0
0 0 0 0

AIsolver.findBestMove gives "Up" as the result, which is an invalid move, as the board does not change because of this movement.
In the Board.action method, for this invalid move, random cell is further added.

So, if we put the restriction for adding random cell only after a valid move, the present Java code will stuck on a board resulting in an invalid move (as given in the above example).

This issue is solved by checking the boardArray after move operation. If the board remains same, even after the move operation, that direction will not be used.
Slight modifications on the solution of the athinarayanan for the invalid move bug.

Signed-off-by: Vasilis Vryniotis <bbriniotis@datumbox.com>