女巫模块
# 为实现狼人杀游戏的python代码
use = 0 # 判断女巫是否使用双药的变量
input('女巫行动时间,按下Enter键以继续')
print('当前拥有:' + ' , '.join(witch_list)) # witch_list中存放的是‘解药’,‘毒药’
print('当前存活的有:' + ' 、 '.join(su))
print('狼队袭击了' + str(killed) + '号玩家') if '解药' in witch_list else '你已经没有解药了,无法查看狼队袭击玩家'
if '解药' in witch_list:
a = input('你要救他吗?是输入yes。')
if a == 'yes':
use = 1 # 女巫使用解药
witch_list.remove('解药')
def witch_input():
try:
k = int(input('你要毒谁?'))
except ValueError:
print('输入数字。')
return witch_input()
else:
return k
if '毒药' in witch_list:
if use != 1:
print('你可以使用毒药')
c = input('是否使用毒药,是输入yes')
if c == 'yes':
killed_by_witch = witch_input()
witch_list.remove('毒药')
else:
killed_by_witch = 'none'
print('\n'*40)