Checkmate and stalemate

Done with checking for checkmate and stalemate.