Changed while loop to incorporate winning strategy