Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // --- results ---
- {
- packRates: {
- wildcard: {
- common: 0.3333333333333333,
- uncommon: 0.3666666666666667,
- rare: 0.16979166666666667,
- mythic: 0.03854166666666667,
- },
- regular: {
- common: 4.666666666666667,
- uncommon: 1.8,
- rare: 0.8385416666666667,
- mythic: 0.11979166666666667,
- },
- },
- draftSim: {
- winExpectation: [
- 0.0625,
- 0.125,
- 0.15625,
- 0.15625,
- 0.13671875,
- 0.109375,
- 0.08203125,
- 0.171875,
- ],
- averageWins: 3.7578125,
- averageReward: 3.6708593749999996,
- },
- fivePacks: {
- wildcard: {
- common: 1.6666666666666665,
- uncommon: 1.8333333333333335,
- rare: 0.8489583333333334,
- mythic: 0.19270833333333334,
- },
- regular: {
- common: 23.333333333333336,
- uncommon: 9,
- rare: 4.192708333333334,
- mythic: 0.5989583333333334,
- },
- },
- draftRewards: {
- wildcard: {
- common: 1.2236197916666665,
- uncommon: 1.3459817708333333,
- rare: 0.6232813313802082,
- mythic: 0.14148103841145832,
- },
- regular: {
- common: 27.13067708333333,
- uncommon: 9.607546875,
- rare: 3.9531685384114583,
- mythic: 0.5647383626302083,
- },
- },
- }
- // --- calculation ---
- /*
- Expected outcome and reward for a draft
- */
- function simulateDraftgames (matchWinrate) {
- 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
- const winExpectation = Array(8).fill(0);
- const p = matchWinrate;
- (function iterate (w, l, pathProbability) {
- if (w === 7) {
- winExpectation[w] += pathProbability;
- return;
- }
- if (l === 3) {
- winExpectation[w] += (1 - p) * pathProbability;
- iterate(w + 1, l, p * pathProbability);
- return;
- }
- iterate(w + 1, l, p * pathProbability);
- iterate(w, l + 1, (1 - p) * pathProbability);
- return;
- })(0, 0, 1);
- const averageWins = winExpectation.reduce( (acc, p, w) => acc + p * w );
- const averageReward = winExpectation.reduce( (acc, p, w) => acc + p * rewards[w] );
- return {winExpectation, averageWins, averageReward};
- }
- /*
- Expected outcome from opening booster backs
- */
- const mythicPackRate = 1/8;
- const mythicWheelRate = 1/5;
- const wildcards = {
- replaceChance: {
- common: 1/3,
- uncommon: 1/5,
- rare: 1/24,
- mythic: 1/24,
- },
- rewardRate: {
- common: 0,
- uncommon: 1/6,
- rare: (1 - mythicWheelRate) * 1/6,
- mythic: mythicWheelRate * 1/6, // every 5th rare wildcard reward is a mythic instead of a rare
- },
- };
- const packRates = {
- wildcard: {
- common: wildcards.replaceChance.common + wildcards.rewardRate.common,
- uncommon: wildcards.replaceChance.uncommon + wildcards.rewardRate.uncommon,
- rare: (1 - mythicPackRate) * wildcards.replaceChance.rare + wildcards.rewardRate.rare,
- mythic: mythicPackRate * wildcards.replaceChance.mythic + wildcards.rewardRate.mythic,
- },
- regular: {
- common: 5 - wildcards.replaceChance.common,
- uncommon: 2 - wildcards.replaceChance.uncommon,
- rare: (1 - mythicPackRate) * (1 - wildcards.replaceChance.rare),
- mythic: mythicPackRate * (1 - wildcards.replaceChance.mythic),
- },
- };
- function expectedCardAmount (packs) {
- return {
- wildcard: Object.fromEntries(
- Object.entries(packRates.wildcard).map( ([rarity, rate]) => [rarity, packs * rate] )
- ),
- regular: Object.fromEntries(
- Object.entries(packRates.regular).map( ([rarity, rate]) => [rarity, packs * rate] )
- ),
- };
- }
- /*
- calculating some examples
- */
- const fivePacks = expectedCardAmount(5);
- const draftSim = simulateDraftgames(0.5);
- const draftRewards = expectedCardAmount(draftSim.averageReward);
- draftRewards.regular.common += 10;
- draftRewards.regular.uncommon += 3;
- draftRewards.regular.rare += 1 - mythicPackRate;
- draftRewards.regular.mythic += mythicPackRate;
- return {packRates, draftSim, fivePacks, draftRewards};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement