小游戏(Python)

import random

import time

print(‘-‘*6,’欢迎来到小游戏’,’-‘*6)

print(‘作者:伤心老果冻’)

a_p=0

b_p=0

dead_team=0

while True:

while True:

win=int(input(‘请输入胜利目标’))

time.sleep(0.5)

num=int(input(‘请输入总人数:’))

time.sleep(0.5)

a=random.randint(int(float(num)/2.1),int(float(num)/1.9))

b=num-a

while True:

choose=int(input(”’你要做什么:

1.查看

2.杀人”’))

time.sleep(0.5)

if choose==1:

print(‘红队人数:’,a)

time.sleep(0.5)

print(‘红队分数:’,a_p)

time.sleep(0.5)

print(‘蓝队人数:’,b)

time.sleep(0.5)

print(‘蓝队分数:’,b_p)

time.sleep(0.5)

if choose==2:

dead_amount=int(random.randint(2,int(num/3)))

for i in range(dead_amount):

dead_team=random.randint(0,1)

if dead_team==0:

a-=1

else:

b-=1

num-=1

print(‘死亡人数:’,dead_amount)

time.sleep(0.5)

if a<=0:break

if b<=0:break

if a<=0:

print(‘蓝队赢了一局’)

time.sleep(0.5)

else:

print(‘红队赢了一局’)

time.sleep(0.5)

c=input(‘输入随意继续游戏’)

if a<=0:

b_p+=1

else:

a_p+=1

if a==win:

print(“红队赢了”)

time.sleep(0.5)

break

if b==win:

print(‘蓝队赢了’)

time.sleep(0.5)

break

c=input(‘输入1再来一次:’)

time.sleep(0.5)

if c!=1:

break

print(‘下次见!!!’)