SIF复读机简易模拟程序
反正就是一个简易模拟
不过目前貌似还挺不准,不知道是哪个判定有问题
$(document).ready(function (){ $("#start").click(function (){ var cardset1=[]; cardset1[0]=[1,0,54,.28,21040,57755]; //[type,饰品type,note,概率,8级效果,16级效果] //type1:分 cardset1[1]=[1,0,54,.29,20310,55770]; cardset1[2]=[2,0,27,.54]; //type2:复读 cardset1[3]=[2,0,27,.54]; cardset1[4]=[2,0,27,.54]; cardset1[5]=[2,0,27,.54]; cardset1[6]=[2,0,27,.54]; cardset1[7]=[2,3,16,.32,0,0,.4]; cardset1[8]=[2,0,27,.54]; //饰品type3:LV var cardset2=[]; cardset2[0]=[1,0,54,.28,21040,57755]; cardset2[1]=[1,0,54,.29,20310,55770]; cardset2[2]=[2,0,27,.54]; cardset2[3]=[2,0,27,.54]; cardset2[4]=[2,0,27,.54]; cardset2[5]=[2,0,27,.54]; cardset2[6]=[2,0,27,.54]; cardset2[7]=[2,0,27,.54]; cardset2[8]=[3,3,16,.39,0,0,.4]; var cardset3=[]; cardset3[0]=[1,0,54,.28,21040,57755]; cardset3[1]=[1,0,54,.29,20310,55770]; cardset3[2]=[2,0,27,.54]; cardset3[3]=[2,0,27,.54]; cardset3[4]=[2,0,27,.54]; cardset3[5]=[2,0,27,.54]; cardset3[6]=[2,0,27,.54]; cardset3[7]=[2,3,17,.3,0,0,.4]; cardset3[8]=[2,3,16,.32,0,0,.4]; var cardset=cardset1; testcard=function (cardset){ var nextlv=0; var fudu=[0]; var fudu_this=[0]; var score=0; var burstscore=function(data){ if (nextlv==0){ score+=data[4]*2.5; fudu=[1,0,0,0,data[4],data[4]]; }else{ score+=data[5]*2.5; nextlv=0; fudu=[1,0,0,0,data[5],data[5]]; } if (fudu_this[0]==0){ fudu_this=fudu; } } var lvup=function (){ nextlv=8; fudu=[3]; } var skillagain=function (){ if (fudu_this[0]==0){ if (fudu[0]==1){ burstscore(fudu); } }else{ if (fudu_this[0]==1){ burstscore(fudu_this); } } } for (var i=1;i<=445;i++){ fudu_this=[0]; for (var ci=0;ci<9;ci++){ if (i%cardset[ci][2]==0){ //判断n数符合发动技能 if (Math.random()<cardset[ci][3]){ //卡叫了 if (cardset[ci][0]==1){ //type1:分卡 burstscore(cardset[ci]); }else if (cardset[ci][0]==2){ //type2:复读 skillagain(); }else if (cardset[ci][0]==3){ //type3:LV lvup(); } }else if (cardset[ci][1]>0 && Math.random()<cardset[ci][6]){ //发动饰品 if (cardset[ci][1]==3){ lvup(); } } } } } return score; } var maxscore=0; var totalscore=0; var total=10000; var good=0; var bad=0; for (var i=0;i<total;i++){ var score=testcard(cardset); if (score>maxscore){ maxscore=score; } if (score>4000000){ good++; } if (score<3000000){ bad++; } totalscore+=score; } $("#result").val("最高分:"+(Math.floor(maxscore/10000))+"万\r\n平均分:"+(Math.floor(totalscore/total/10000))+"万\r\n好:"+good+"次\r\n坏:"+bad+"次"); }); });
2022
03 20
上一篇
Older
下一篇
Newer
评论
0
点击
603