女巫模塊
# 為實(shí)現(xiàn)狼人殺游戲的python代碼
use = 0 ?# 判斷女巫是否使用雙藥的變量
input('女巫行動(dòng)時(shí)間,按下Enter鍵以繼續(xù)')
print('當(dāng)前擁有:' + ' , '.join(witch_list)) ?# witch_list中存放的是‘解藥’,‘毒藥’
print('當(dāng)前存活的有:' + ' 、 '.join(su))
print('狼隊(duì)襲擊了' + str(killed) + '號(hào)玩家') if '解藥' in witch_list else '你已經(jīng)沒(méi)有解藥了,無(wú)法查看狼隊(duì)襲擊玩家'
if '解藥' in witch_list:
? ?a = input('你要救他嗎?是輸入yes。')
? ?if a == 'yes':
? ? ? ?use = 1 ?# 女巫使用解藥
? ? ? ?witch_list.remove('解藥')
def witch_input():
? ?try:
? ? ? ?k = int(input('你要毒誰(shuí)?'))
? ?except ValueError:
? ? ? ?print('輸入數(shù)字。')
? ? ? ?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)