t=0
while True:
t+=1
input("第"+str(t)+"关")
s=randint(2,2)
print("开始!")
sleep(s)
ans=int(input("猜一猜:"))
dis=abs(ans-s)
if(dis>1):
print("回答错误,游戏结束")
break
elif(ans==s):
print("恭喜你答对了")
else:
f=1
for i in range(1,3):
print("答案接近,再猜一次,你还有最多"+str(3-i)+"次机会")
ans=int(input("猜一猜:"))
dis=abs(ans-s)
if(dis>2):
break
elif(ans==s):
f=0
break
if f:
print("回答错误,游戏结束")
break
else:
print("恭喜你答对了")