Fixing Exceptions observed during execution

Added checks fro fixing divie-by-zero errors.
If the NoOfMoves for a piece are zero, selecting another piece.

Signed-off-by: Mayuresh Janorkar <janorkar@usc.edu>