Advertisement
Guest User

MTG Arena Draft vs. Pack Opening

a guest
Aug 20th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // --- results ---
  2.  
  3. {
  4.     packRates:     {
  5.                     wildcard: {
  6.                                 common:   0.3333333333333333,
  7.                                 uncommon: 0.3666666666666667,
  8.                                 rare:     0.16979166666666667,
  9.                                 mythic:   0.03854166666666667,
  10.                             },
  11.                     regular:  {
  12.                                 common:   4.666666666666667,
  13.                                 uncommon: 1.8,
  14.                                 rare:     0.8385416666666667,
  15.                                 mythic:   0.11979166666666667,
  16.                             },
  17.                 },
  18.     draftSim:      {
  19.                     winExpectation:     [
  20.                                         0.0625,
  21.                                         0.125,
  22.                                         0.15625,
  23.                                         0.15625,
  24.                                         0.13671875,
  25.                                         0.109375,
  26.                                         0.08203125,
  27.                                         0.171875,
  28.                                     ],
  29.                     averageWins:        3.7578125,
  30.                     averageReward:      3.6708593749999996,
  31.                 },
  32.     fivePacks:     {
  33.                     wildcard: {
  34.                                 common:   1.6666666666666665,
  35.                                 uncommon: 1.8333333333333335,
  36.                                 rare:     0.8489583333333334,
  37.                                 mythic:   0.19270833333333334,
  38.                             },
  39.                     regular:  {
  40.                                 common:   23.333333333333336,
  41.                                 uncommon: 9,
  42.                                 rare:     4.192708333333334,
  43.                                 mythic:   0.5989583333333334,
  44.                             },
  45.                 },
  46.     draftRewards:  {
  47.                     wildcard: {
  48.                                 common:   1.2236197916666665,
  49.                                 uncommon: 1.3459817708333333,
  50.                                 rare:     0.6232813313802082,
  51.                                 mythic:   0.14148103841145832,
  52.                             },
  53.                     regular:  {
  54.                                 common:   27.13067708333333,
  55.                                 uncommon: 9.607546875,
  56.                                 rare:     3.9531685384114583,
  57.                                 mythic:   0.5647383626302083,
  58.                             },
  59.                 },
  60. }
  61.  
  62. // --- calculation ---
  63.  
  64. /*
  65.     Expected outcome and reward for a draft
  66. */
  67.  
  68. function simulateDraftgames (matchWinrate) {
  69.     const rewards = [1.45, 1.72, 2.24, 2.76, 3.55, 4.60, 5.65, 6.75];  // booster packs plus gems converted to booster packs
  70.     const winExpectation = Array(8).fill(0);
  71.  
  72.     const p = matchWinrate;
  73.     (function iterate (w, l, pathProbability) {
  74.         if (w === 7) {
  75.             winExpectation[w] += pathProbability;
  76.             return;
  77.         }
  78.         if (l === 3) {
  79.             winExpectation[w] += (1 - p) * pathProbability;
  80.             iterate(w + 1, l, p * pathProbability);
  81.             return;
  82.         }
  83.         iterate(w + 1, l,     p       * pathProbability);
  84.         iterate(w,     l + 1, (1 - p) * pathProbability);
  85.         return;
  86.     })(0, 0, 1);
  87.  
  88.     const averageWins = winExpectation.reduce( (acc, p, w) => acc + p * w );
  89.     const averageReward = winExpectation.reduce( (acc, p, w) => acc + p * rewards[w] );
  90.  
  91.     return {winExpectation, averageWins, averageReward};
  92. }
  93.  
  94. /*
  95.     Expected outcome from opening booster backs
  96. */
  97.  
  98. const mythicPackRate = 1/8;
  99. const mythicWheelRate = 1/5;
  100.  
  101. const wildcards = {
  102.     replaceChance: {
  103.         common:   1/3,
  104.         uncommon: 1/5,
  105.         rare:     1/24,
  106.         mythic:   1/24,
  107.     },
  108.     rewardRate: {
  109.         common:   0,
  110.         uncommon: 1/6,
  111.         rare:     (1 - mythicWheelRate) * 1/6,
  112.         mythic:   mythicWheelRate       * 1/6,  // every 5th rare wildcard reward is a mythic instead of a rare
  113.     },
  114. };
  115.  
  116. const packRates = {
  117.     wildcard: {
  118.         common:                          wildcards.replaceChance.common   + wildcards.rewardRate.common,
  119.         uncommon:                        wildcards.replaceChance.uncommon + wildcards.rewardRate.uncommon,
  120.         rare:     (1 - mythicPackRate) * wildcards.replaceChance.rare     + wildcards.rewardRate.rare,
  121.         mythic:   mythicPackRate *       wildcards.replaceChance.mythic   + wildcards.rewardRate.mythic,
  122.     },
  123.     regular: {
  124.         common:   5                    - wildcards.replaceChance.common,
  125.         uncommon: 2                    - wildcards.replaceChance.uncommon,
  126.         rare:     (1 - mythicPackRate) * (1 - wildcards.replaceChance.rare),
  127.         mythic:   mythicPackRate       * (1 - wildcards.replaceChance.mythic),
  128.     },
  129. };
  130.  
  131. function expectedCardAmount (packs) {
  132.     return {
  133.         wildcard: Object.fromEntries(
  134.             Object.entries(packRates.wildcard).map( ([rarity, rate]) => [rarity, packs * rate] )
  135.         ),
  136.         regular: Object.fromEntries(
  137.             Object.entries(packRates.regular).map( ([rarity, rate]) => [rarity, packs * rate] )
  138.         ),
  139.     };
  140. }
  141.  
  142. /*
  143.     calculating some examples
  144. */
  145.  
  146. const fivePacks = expectedCardAmount(5);
  147.  
  148. const draftSim = simulateDraftgames(0.5);
  149.  
  150. const draftRewards = expectedCardAmount(draftSim.averageReward);
  151. draftRewards.regular.common += 10;
  152. draftRewards.regular.uncommon += 3;
  153. draftRewards.regular.rare += 1 - mythicPackRate;
  154. draftRewards.regular.mythic += mythicPackRate;
  155.  
  156. return {packRates, draftSim, fivePacks, draftRewards};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement