Pythonによる仮面ライダー轟音平均出玉シミュレーション値
そのままコピペしてpython動く環境で動かしてもらえばシミュレーション値は出るかも。
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 18:19:03 2020
@author: HOST1191
"""
import random
import statistics
import collections
import matplotlib.pyplot as plt
import seaborn as sns
#仮面ライダー轟音振り分け
def furi():
furir = random.randint(1,100)
furideda = 0
furiflg = 0
if furir >= 1 and furir <= 35:
furideda += 1400
furiflg = 0
elif furir >= 36 and furir <= 80:
furideda += 1400
furiflg += 1
elif furir >= 81 and furir <= 85:
furideda += 280
furiflg = 0
else:
furideda += 280
furiflg += 1
return furideda,furiflg
#仮面ライダー轟音連荘の関数定義
def renchan(kakuhen1,flg):
hatu = random.randint(1,100)
if hatu >= 1 and hatu <= 99:
dedama = 420
else:
dedama = 1400
ren = 1
suru = 0
jitan = 0
st = 0
while suru < 1:
#転落抽選
#確変
if kakuhen1 == 0:
tyusen1 = random.random()
st += 1
if tyusen1 <= (1/74.7):
ren += 1
furideda,flg = furi()
dedama += furideda
st = 0
jitan = 0
else:
if st > 120:
if flg == 0:
kakuhen1 += 1
jitan = 0
else:
suru += 1
#時短の処理
else:
#引き戻し抽選
tyusen2 = random.random()
jitan += 1
if jitan >= 124:
suru += 1
else:
if tyusen2 <= (1/319.7):
ren += 1
furideda,flg = furi()
dedama += furideda
kakuhen1 = 0
jitan = 0
st = 0
# print ("ren=",ren)
return ren,dedama
"""ここからラッシュ評価"""
#連荘性能の評価
#ラッシュ突入回数
sikou = 100000
#連荘回数
ren1 = []
#ラッシュの出玉数
dedama1 = []
for sim in range(1,sikou+1):
#初当たりの振り分け処理
furiwake1 = random.randint(1,100)
if furiwake1 >= 1 and furiwake1 <= 50:
ren,dedama = renchan(1,1)
elif furiwake1 >= 51 and furiwake1 <= 89:
ren,dedama = renchan(0,1)
elif furiwake1 >= 90 and furiwake1 <= 99:
ren,dedama = renchan(0,0)
else:
ren,dedama = renchan(0,0)
dedama1.append(dedama)
ren1.append(ren)
#連荘平均数
m1 = statistics.mean(ren1)
m2 = statistics.mean(dedama1)
#連荘と出玉の整理
ren1.sort()
dedama1.sort()
print ("連荘数=",ren1)
#print ("出玉数=",dedama1)
print('連荘平均: {0:.2f}'.format(m1))
print('出玉平均: {0:.1f}'.format(m2))
ren_bunpu = collections.Counter(ren1)
dedama_bunpu = collections.Counter(dedama1)
#print(ren_bunpu)
#出玉の円グラフ作表用定義
x1 = sum( x1 <= 1000 for x1 in dedama1)
x2 = sum( 1000 < x2 <= 5000 for x2 in dedama1)
x3 = sum( 5000 < x3 <= 10000 for x3 in dedama1)
x4 = sum( 10000 < x4 for x4 in dedama1)
Xgraph = ["{0:.1f}".format(x1/sikou*100),"{0:.1f}".format(x2/sikou*100),
"{0:.1f}".format(x3/sikou*100),"{0:.1f}".format(x4/sikou*100)]
label = ["tan","ika","manti","manpatu"]
colors2 = ["0.3", "0.5", "0.7", "0.9", "1.1"]
plt.pie(Xgraph, labels=label, counterclock=False, startangle=90, colors=colors2,autopct="%1.1f%%")
plt.axis('equal')
d = list(ren_bunpu.keys())
e = list(ren_bunpu.values())
sns.set()
sns.set_style("darkgrid", {'grid.linestyle': '--'})
sns.set_context("paper", 1.0, {"lines.linewidth": 1})
sns.set_palette("winter_r", 2, 1)
sns.set('talk', 'darkgrid', 'dark', font_scale=1.0,
rc={"lines.linewidth": 10, 'grid.linestyle': '--'})
fig, ax = plt.subplots(figsize = (10,5))
ax.set(xlabel ='ren', ylabel='occcurs', xlim=(0,80), ylim=(0,1000))
ax.bar(d,e)
plt.show()