implemented stalemate check