Created the check win function.