Created
May 11, 2014 20:35
-
-
Save borlaym/6c948341ebf6e69cc24a to your computer and use it in GitHub Desktop.
MtG number of copies needed of each card for a Draft Simulator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var numberOfDifferentCards = 109; | |
var amountOfEach = 10; | |
var numberInBooster = 10; | |
var numberOfBoosters = 3; | |
var numberOfPlayers = 8; | |
var numberOfTests = 300; | |
var results = []; | |
console.clear(); | |
function test() { | |
var pool = []; | |
for (var i = 0; i < numberOfDifferentCards; i++) { | |
pool[i] = amountOfEach; | |
} | |
var misses = 0; | |
for (var i = 0; i < numberOfBoosters*numberInBooster*numberOfPlayers; i++) { | |
var pick; | |
var miss = false; | |
do { | |
pick = Math.floor(Math.random() * numberOfDifferentCards); | |
if (miss) misses++; | |
miss = true; | |
} while (pool[pick] === 0) | |
pool[pick]--; | |
} | |
results.push(misses); | |
} | |
for (var j = 0; j < numberOfTests; j++) { | |
test(); | |
} | |
var sum = 0; | |
for (var d = 0; d < results.length; d++) { | |
sum += results[d]; | |
} | |
var avg = sum / results.length; | |
console.log("Avg: ", avg, " Results: ",results); | |
//Findings: | |
//Number of commons for a large set: 7 (6-nál átlag 1 reroll volt) | |
//Number of commons for a small set: 9 (8-nál átlag 1 reroll volt) | |
//Number of uncommons for a large set: 4 (3-nál átlag 1 reroll volt) | |
//Number of uncommons for a small set: 5 (4-nél átlag 1 reroll volt) | |
//Number of rares for a large set: 2 | |
//Number of rares for a large set: 3 (2-nél átlag 1 reroll volt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment