0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【ポケポケ】強い手札が来る確率

Posted at

ポケポケにおける運ゲー

ポケポケ、最高の運ゲーですよね。
先行決め、コイン技、混色エネルギー、手札運など…
ということで、この中で計算が難しそうな、手札についての運ゲーの確率を求めたいと思います。

調べるのは、
1.欲しい札が1ターン目開始時に引ける確率
2.最速で1進化ポケモンが完成する確率
3.最速で2進化ポケモンが完成する確率
この3つです。

検証に使うプログラム

検証には、以下のプログラムを使います。
言語はjavascriptです。

    const test = () => {
      const nameExist = (name) => {
        return hand.findIndex((card) => card.name === name) === -1
          ? false
          : hand.findIndex((card) => card.name === name);
      };
      const idExist = (id) => {
        return hand.findIndex((card) => card.id === id) === -1
          ? false
          : hand.findIndex((card) => card.id === id);
      };
      const shuffle = () => {
        for (let i = stack.length - 1; i > 0; i--) {
          const j = (Math.random() * (i + 1)) | 0;
          [stack[i], stack[j]] = [stack[j], stack[i]];
        }
      };
      const addHand = (n) => {
        if (stack.length > 0) {
          while (n--) {
            hand.push(stack[0]);
            stack.shift();
          }
        }
      };
      const addSeed = () => {
        if ((t = stack.findIndex((card) => card.id === "タネ")) !== -1) {
          hand.push(stack[t]);
          stack.splice(t, 1);
        }
      };

      stack = [
        { name: "博士", id: "" },
        { name: "博士", id: "" },
        { name: "モンボ", id: "" },
        { name: "モンボ", id: "" },
        { name: "エリカ", id: "" },
        { name: "エリカ", id: "" },
        { name: "スピーダー", id: "" },
        { name: "スピーダー", id: "" },
        { name: "セレビィ", id: "タネ" },
        { name: "セレビィ", id: "タネ" },
        { name: "タマタマ", id: "タネ" },
        { name: "タマタマ", id: "タネ" },
        { name: "ナッシー", id: "タマタマ" },
        { name: "ナッシー", id: "タマタマ" },
        { name: "ツタージャ", id: "タネ" },
        { name: "ツタージャ", id: "タネ" },
        { name: "ジャノビー", id: "ツタージャ" },
        { name: "ジャノビー", id: "ツタージャ" },
        { name: "ジャローダ", id: "ジャノビー" },
        { name: "ジャローダ", id: "ジャノビー" },
      ];
      let hand = [];
      let bench = [];

      shuffle();
      addSeed();
      addHand(4);

      //ターンごとの処理
      for (i = 0; i < 3; i++) {
        addHand(1);
        while (nameExist("モンボ") !== false) {
          addSeed();
          hand.splice(nameExist("モンボ"), 1);
          shuffle();
        }
        if (nameExist("博士") !== false) {
          addHand(2);
          hand.splice(nameExist("博士"), 1);
        }
        while (nameExist("モンボ") !== false) {
          addSeed();
          hand.splice(nameExist("モンボ"), 1);
          shuffle();
        }
        bench = bench.map((card) => {
          if ((t = idExist(card.name)) !== false) {
            let evolve = hand[t];
            hand.splice(t, 1);
            return evolve;
          } else return card;
        });
        while ((t = idExist("タネ")) !== false) {
          bench.push(hand[t]);
          hand.splice(t, 1);
        }
      }
      if("調べたいこと"){
      return 1;
      } else{
      return 0;
      };
    };
    
    let hit = 0;
    repeat = 1000000;
    
    for (c = 0; c < repeat; c++) {
      hit += test();
    };
    
    console.log((hit / repeat) * 100 + "%");

このプログラムをいろいろいじって使います。
試す回数は100万回です。
よく見るとベンチにポケモンが無限に置ける仕様になっていますが、特に関係ないはずです。

1.欲しい札が1ターン目開始時に引ける確率

初手カスミ、されたらかなり面倒ですね。確率を求めましょう。
初めに引く5枚+ターン開始時に引く1枚=6枚の中に狙いのカードがある確率を求めます。

if (nameExist("博士")) {
  return 1;
} else {
  return 0;
}

ターン処理も割愛しますが少しいじっています。
今回は目当てのカードを博士にします。結果は…
51.0213% でした。
5割を少し超えているようです。何回か実行しましたが、全て51%台だったので間違いなさそうですね。

2.最速で1進化ポケモンが完成する確率

if (bench.findIndex((card) => card.name === "ナッシー") !== -1) {
  return 1;
} else {
  return 0;
}

2ターン以内にナッシーが完成する確率を求めます。

結果は…
タネポケモンが6枚の場合→50.0447%
4枚の場合→55.6683%
2枚(タマタマのみ)の場合→66.7425%
でした。私は34%を引くのが得意なようです

確率が高くて驚いた方も多いのではないでしょうか。

ちなみに、3ターンで完成する確率は、
順番に、62.4025%、66.9832%、74.4227%でした。

3.最速で2進化ポケモンが完成する確率

どんどん行きましょう。

if (bench.findIndex((card) => card.name === "ジャローダ") !== -1) {
  return 1;
} else {
  return 0;
}

3ターン以内にジャローダが完成する確率を求めます。

結果は…
タネ6枚→36.473%
タネ4枚→40.6378%
タネ2枚→48.1312%
でした。もっと低いと思っていたんですが、1/3以上の確率で最速2進化ができるようです。相手がやる場合は100%ですが

4ターンだと、
50.4814%、54.0674%、59.3781%でした。

最後に

ぜひ、皆さんもこのコードをいじっていろいろ試してみてくだい。

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?