finish checkWin function.