Last active
December 6, 2020 16:51
-
-
Save hiside0/c1d6e324eee716e7d640353358245098 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from ctypes import * | |
import numpy as np | |
import mltd_calc | |
SONG = 171 # 計算したい曲番号 参考:https://bit.ly/2EJG2bm | |
MODE = 5 # 1=2M, 2=2M+, 3=4M, 4=6M, 5=MM, 6=OM | |
TRIALS = 100000 # 試行回数 | |
TARGET_NOTE = 0 # [TARGET_NOTE]番目のノーツまで計算する(0:計算しない) | |
IDEAL = False # 理論値計算するかどうか指定 | |
VERBOSE = True # 詳細を表示 | |
# 下のTOTAL_APPEAL, CARD_IDS, SKILL_LVSでユニット情報を設定する | |
TOTAL_APPEAL = 395293 | |
# 配列中のカンマ区切りの数字がユニット番号 参考:https://bit.ly/3jcTJhK | |
CARD_IDS = np.array([983, 669, 869, 462, 555], dtype=c_int32) | |
# 〃 スキルレベル | |
SKILL_LVS = np.array([10, 10, 10, 10, 10], dtype=c_int32) | |
# 補助機能用 | |
TARGET_P = 0.5 | |
# 以下は編集の必要なし | |
# 呼び出し | |
arrays = mltd_calc.calc_by_card_array( | |
SONG, MODE, TOTAL_APPEAL, CARD_IDS, SKILL_LVS, TRIALS, TARGET_NOTE, | |
IDEAL, VERBOSE) | |
if arrays[0][0] <= 0: | |
print("実行エラー") | |
sys.exit() | |
array_total = [x[0] for x in arrays] | |
array_before_sa = [x[1] for x in arrays] | |
array_target_note = [x[2] for x in arrays] | |
def print_tile(tile): | |
print(" {:>6}%Tile score:".format(tile), | |
int(np.percentile(array_total, 100-tile)), | |
" before SA:", | |
int(np.percentile(array_before_sa, 100-tile)), | |
" SA or later:", | |
int(np.percentile(array_total, 100-tile) | |
- np.percentile(array_before_sa, 100-tile)), | |
" target note(score):", | |
int(np.percentile(array_target_note, 100-tile))) | |
if IDEAL is True: | |
print(r" ideal score:", int(array_total[0]), | |
" just before_SA score:", int(array_before_sa[0])) | |
else: | |
print("\ntarget note : ", TARGET_NOTE) | |
if TRIALS >= 10000: | |
print_tile(0.001) | |
print_tile(0.01) | |
print_tile(0.05) | |
print_tile(0.1) | |
print_tile(0.5) | |
if TRIALS >= 1000: | |
print_tile(1) | |
print_tile(2) | |
print_tile(5) | |
print_tile(10) | |
print_tile(50) | |
if TRIALS == 1: | |
print(r" total score:", | |
int(array_total[0]), | |
" just before_SA score:", | |
int(array_before_sa[0])) | |
def print_saorlater(tile): | |
print(int(np.percentile(array_total, 100 - TARGET_P)) | |
- (int(np.percentile(array_total, 100-tile)) | |
- int(np.percentile(array_before_sa, 100-tile))), | |
": {:>6}%Tile".format(tile)) | |
print("\n最終", | |
str(TARGET_P), | |
"%Tileスコアを目標としていて、SA前のスコアが[A]だった場合に、", | |
"SA以後(SAを含む)は[B]%Tileのスコアが必要になる:",sep='') | |
print("[A] : [B]") | |
print_saorlater(0.1) | |
print_saorlater(1) | |
print_saorlater(10) | |
print_saorlater(50) | |
print_saorlater(90) | |
print_saorlater(99) | |
print_saorlater(99.9) | |
# .\out.csvに結果を出力 | |
def format(value): | |
return "%d" % int(value) | |
with open('out.csv', 'w') as f: | |
for index in range(len(arrays)): | |
f.write(str(format(arrays[index][0]))+',') | |
f.write(str(format(arrays[index][1]))+',') | |
f.write(str(format(arrays[index][2]))+'\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment