cleaned up duplicate code for checking the logic on who has won  the game