This Gist was automatically created by Carbide, a free online programming environment.
Created
March 20, 2017 05:49
-
-
Save carbide-public/546bdbf339a27af4909ec608ac57a8d3 to your computer and use it in GitHub Desktop.
untitled
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
//there are 2 four-side, 3 six-sided, 4 eight-sided, 5 twelve-sided | |
//and 6 twenty-sided dice in a bag | |
let bag = [ | |
4,4, | |
6,6,6, | |
8,8,8,8, | |
12,12,12,12,12, | |
20,20,20,20,20,20 | |
] | |
let pn = { | |
4: 2/20, | |
6: 3/20, | |
8: 4/20, | |
12: 5/20, | |
20: 6/20, | |
} | |
let dice = [4,6,8,12,20] | |
let p6givenn = {} | |
dice.forEach(n => p6givenn[n] = n < 6 ? 0 : 1/n) | |
p6givenn | |
// let pd = dice.map((d,i) => * p6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment