Last active
January 6, 2022 15:48
-
-
Save Hidden50/affdd4c0a192c676e7b3db6e14717d0c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
stone slots 0b 0-% 1b 1-% 2b 2-% 3b 3-% perm | |
0 1 100% 0 0% 0 0% 0 0% 1 | |
1 9 100% 0 0% 0 0% 0 0% 9 | |
2 36 100% 0 0% 0 0% 0 0% 36 | |
3 78 93% 6 7% 0 0% 0 0% 84 | |
4 90 71% 36 29% 0 0% 0 0% 126 | |
5 45 36% 72 57% 9 7% 0 0% 126 | |
6 6 7% 36 43% 42 50% 0 0% 84 | |
7 0 0% 0 0% 18 50% 18 50% 36 | |
8 0 0% 0 0% 0 0% 9 100% 9 | |
9 0 0% 0 0% 0 0% 1 100% 1 | |
*/ | |
const rowA = 0b111000000; | |
const rowB = 0b000111000; | |
const rowC = 0b000000111; | |
const colA = 0b100100100; | |
const colB = 0b010010010; | |
const colC = 0b001001001; | |
const bingoConditions = [rowA, rowB, rowC, colA, colB, colC]; | |
const stats = Array(10).fill().map( () => Array(4).fill(0) ); | |
for (let i = 0b111111111; i >= 0; i--) { | |
const bingoCount = Math.min(3, bingoConditions.filter( b => (b & i) === b ).length); | |
let slotCount = 0; | |
for (let j = 0b1000000000; j; j >>= 1) { | |
if (i & j) slotCount++; | |
} | |
stats[slotCount][bingoCount]++; | |
} | |
this.returns(); | |
return inco.tools.tables.fromArray([ | |
["stone slots", "0b", "0-%", "1b", "1-%", "2b", "2-%", "3b", "3-%", "perm"], | |
...stats.map( (row, slotCount) => { | |
const sum = row.reduce( (acc, cur) => acc + cur ); | |
return [ | |
slotCount, | |
...row.flatMap( b => [b, Math.round(100 * b / sum) + "%"] ), | |
sum, | |
]; | |
}), | |
], {colSep: 5, align: "r"}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment