前几天抽KiraFan的Manga Time Kirara MAX卡池十连,7发下来加上最后给的五星卡限定券,一共出了六张五星卡。我担心消耗太多欧气导致下次抽卡失利,就用C++写了这么个模拟器,方便在下一次抽卡之前看看欧气攒够了没有。
源码见下,成品请在文末下载。
#include<bits/stdc++.h> using namespace std; int rnd_judge(int rndresult) { int trueresult; if(rndresult > -1 && rndresult < 2) { trueresult = 5; //输出"5"的概率为2% } if(rndresult > 1 && rndresult < 12) { trueresult = 4; //输出"4"的概率为12% } if(rndresult > 11 && rndresult < 100) { trueresult = 3; //输出"3"的概率为86% } return trueresult; } int main() { srand(time(NULL)); printf("Kirara Fantasia Gacha Monitor\n\nCommand Lines Edition v1.01\nBy HonitohiMoyu\n\n"); int rnd[10]; int result[10]; int a; for(a = 0;a < 10;a++) { rnd[a] = rand() % 99; //生成随机数 } for(a = 0;a < 10;a++) { result[a] = rnd_judge(rnd[a]); } int all_three = 0; for(a = 0;a < 10;a++) { if(result[a] == 3) { all_three = all_three + 1; } } int t; t = rand() % 9; if(all_three == 10) { result[t] = 4; //避免全部显示"3" } printf("Gacha Result: "); for(a = 0;a < 10;a++) { cout << result[a] << " "; //显示结果 } printf("\n\n"); system("pause"); return 0; }
Kirara Fantasia Gacha Monitor.exe: 本地下载