游戏规则
有一个函数,传入的参数是名字的列表,函数中的(传递多少次杀人是随机的),只需要看谁的运气好,就可以活到最后!!
Code
def hotPhoto(namelist):
n = len(namelist)
num = randint(1, n)
simqueue = Queue()
for name in namelist:
simqueue.enqueue(name)
while simqueue.size() > 1:
for i in range(num):
simqueue.enqueue(simqueue.dequeue())
simqueue.dequeue()
return '每传递{}次杀死一人,最终剩下{}'.format(num, simqueue.dequeue())
print(hotPhoto(['Mjj', 'James', 'Tom', 'Bruse', 'Jack', 'Jane']))