# 指定游戏局数,让计算机 A 和 B 互相博弈~
import random as r
import time as t
print('===比大小游戏开始叻,请输入计算机A和B的比赛局数,最少99局===')
number = int(input('局数:'))
countA = 1
countB = 1
countnumber = 1
while True:
if number < 99:
print('小于99局,请重新输入!')
number = int(input('局数:'))
elif countnumber < number:
numberA = r.randint(1, 6)
numberB = r.randint(1, 6)
if numberA > numberB:
countA += 1
elif numberA < numberB:
countB += 1
countnumber += 1
else:
break
print(f'A和B共进行{number}局比赛')
t.sleep(0.3)
print('加速统计结果中。。。')
t.sleep(3)
if countA > countB:
print(f'{countA}:{countB}获胜者为A')
elif countA < countB:
print(f'{countA}:{countB}获胜者为B')
else:
print(f'{countA}:{countB},哇哦,A和B棋逢对手!')
页:
1
[2]