功德车竞速源代码

2020/01/23254 浏览修真茶馆
# -*- coding: utf-8 -*-
# @Time : 1/22/2020 4:22 PM
# @Author : Wu Xing
import random
# total_pace = int(input('Enter your total pace:'))
total_pace = 100
Zero_player_pace = [5, 6, 7, 8]
Dinglou_player_pace = [7, 8, 9, 10]
Wanke_player_pace = [10, 11, 12]
WankeX2_player_pace = [11, 12, 13, 14, 15]
def Random_pace(pace):
return random.choice(pace)
def Player_pace_lenth(min, max):
if total_pace / max > int(total_pace / max):
min_days = int(total_pace / max) + 1
else:
min_days = int(total_pace / max)
if total_pace / min > int(total_pace / min):
max_days = int(total_pace / min) + 1
else:
max_days = int(total_pace / min)
return min_days, max_days
# round = int(input('Enter your expected matching round:'))
round = 3000
wanke_win_round = 0
wankeX2_win_round = 0
ping_ju = 0
for timer in range(1, round + 1):
zero_steps = []
dinglou_steps = []
wanke_steps = []
wankeX2_steps = []
wanke_win = 0
wankeX2_win = 0
wanke_rest_day = 0
wankeX2_rest_day = 0
print('round', timer)
for step in range(1, 21):
print('Day', step, ':')
if sum(wanke_steps) > 99 or sum(wankeX2_steps) > 99:
if wanke_rest_day == 0:
if wanke_rest_day < wankeX2_rest_day:
wanke_win = wanke_win + 1
else:
wankeX2_win = wankeX2_win + 1
if wanke_win > wankeX2_win:
wanke_win_round = wanke_win_round + 1
print('1 wan ke WIN.')
elif wanke_win < wankeX2_win:
wankeX2_win_round = wankeX2_win_round + 1
print('2 wan ke WIN.')
elif wanke_win == wankeX2_win:
ping_ju = ping_ju + 1
print('ping ju')
print('round', wanke_win, wankeX2_win)
print()
break
else:
player_steps = [Random_pace(Zero_player_pace),
Random_pace(Dinglou_player_pace),
Random_pace(Wanke_player_pace),
Random_pace(WankeX2_player_pace)]
wanke_rest_day = int((total_pace - sum(wanke_steps)) / 12)
wankeX2_rest_day = int((total_pace - sum(wankeX2_steps)) / 15)
zero_steps.append(player_steps[0])
dinglou_steps.append(player_steps[1])
wanke_steps.append(player_steps[2])
wankeX2_steps.append(player_steps[3])
print('0 Player\'s pace is', player_steps[0], '\tTotal pace is:', sum(zero_steps), '\tRest day is:', 0)
print('3Q Player\'s pace is', player_steps[1], '\tTotal pace is:', sum(dinglou_steps), '\tRest day is:', 0)
print('1W Player\'s pace is', player_steps[2], '\tTotal pace is:', sum(wanke_steps), '\tRest day is:',
wanke_rest_day)
print('2W Player\'s pace is', player_steps[3], '\tTotal pace is:', sum(wankeX2_steps), '\tRest day is:',
wankeX2_rest_day)
# input('press enter to the next day')
# print(wanke_win_round, wankeX2_win_round)
print('\nGame run', round, 'times:\n')
print('1 wan ke win:', wanke_win_round, 'times.')
print('2 wan ke win:', wankeX2_win_round, 'times.')
print('ping ju:', ping_ju, 'times.\n')
print('1 wan ke win percent:', '{:.3%}'.format(wanke_win_round / (wanke_win_round + wankeX2_win_round + ping_ju)))
print('2 wan ke win percent:', '{:.3%}'.format(wankeX2_win_round / (wanke_win_round + wankeX2_win_round + ping_ju)))
3
4