1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ポケポケの5連勝イベントはいうほど運ゲーではないという話

Last updated at Posted at 2025-03-07

結論

勝率0.5で90試合以内に5連勝できる確率 → 0.774777
勝率0.55で90試合以内に5連勝できる確率 → 0.897051
勝率0.6で90試合以内に5連勝できる確率 → 0.964484
勝率0.65で90試合以内に5連勝できる確率 → 0.991669
勝率0.7で90試合以内に5連勝できる確率 → 0.998832

ソース

const 試行回数 = 100_0000;
const 試合数 = 90; // 勝率0.5で45勝するまでの試合数の期待値

function 試合結果(勝率) {
    if (Math.random() < 勝率) {
        return "勝ち";
    }
    else {
        return "負け";
    }
}

function シミュレーション(勝率) {
    let 達成数 = 0;
    for (let i = 0; i < 試行回数; i++) {
        let 連勝数 = 0;
        for (let j = 0; j < 試合数; j++) {
            if (試合結果(勝率) === "勝ち") {
                連勝数 += 1;
                if (連勝数 >= 5) {
                    達成数 += 1;
                    break;
                }
            }
            else {
                連勝数 = 0;
            }
        }
    }
    console.log(`勝率${勝率}${試合数}試合以内に5連勝できる確率 → ${達成数 / 試行回数}`);
}

for (const 勝率 of [0.5, 0.55, 0.6, 0.65, 0.7]) {
    シミュレーション(勝率);
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?