Skip to content

Instantly share code, notes, and snippets.

@bouze
Last active August 16, 2016 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bouze/5ff14d2117ed67cfa73499134eb2a00d to your computer and use it in GitHub Desktop.
Save bouze/5ff14d2117ed67cfa73499134eb2a00d to your computer and use it in GitHub Desktop.
S帯における勝率とウデマエの遷移
//=======================
//勝率
var rate=0.54;
//試合数
var num=200;
//=======================
var udemae=30; var checknum=num;
var up=0; var down=0; var winnum=0; var txt= ""; var checklist=[];
var label = " 10 20 30 40 50 60 70 80 90 100";
var min = num/checknum;
for (var k=0; k<checknum; k++) checklist.push(min*k);
for (var i=0; i<=num; i++)
{
var win = (Math.random() < rate)? true:false;
var isup=false; var isdown=false;
if (win) winnum++;
if (udemae<40 && win) udemae+=5;
else if (udemae<79 && win) udemae+=4;
else if (udemae<=99 && win) udemae+=4;
if (udemae<40 && !win) udemae-=6;
else if (udemae<79 && !win) udemae-=5;
else if (udemae<=99 && !win) udemae-=5;
if (udemae>99) isup=true;
if (udemae<0) isdown=true;
var flag=false;
for (var l=0; l<checklist.length; l++) {
if (i==checklist[l]) flag=true;
}
if (flag){
for (var j=0;j<udemae;j++) txt+= (j==10||j==20||j==30||j==40||j==50||j==60||j==70||j==80||j==90||j==100)? "*":"|";
txt+="\n";
}
if (isup) { up+=1; udemae=70 };
if (isdown) { down+=1; udemae=30 };
}
console.log(label + "\n" + txt + label + "\n\n==================================================================\n設定:勝率"+ String(rate*100) + "%/結果:"+num +"試合中" + winnum + "勝、ランクアップ" + up + "回、ランクダウン" + down +"回\n==================================================================");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment