-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
37 lines (32 loc) · 1.04 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function displayMaster(master){
const actual = {...master};
const percentages = {};
Object.keys(actual).forEach(key => {
const value = actual[key];
const percentKey = key;
const percentValue = getPercent(value, actual['total-games']);
percentages[percentKey] = percentValue;
});
delete percentages['ended-06-with-triple-set'];
// calc 06 triple of 06's
actual['06-with-triple-set'] = actual['ended-06-with-triple-set'];
percentages['06-with-triple-set'] = getPercent(actual['ended-06-with-triple-set'], actual['ended-with-06']);
const keys = Object.keys(percentages).sort();
document.getElementById('stats').innerHTML = keys.map(key => `
<tr>
<td>${key.split('-').join(' ')}</td>
<td>${percentages[key] || ''}</td>
<td>${actual[key] || ''}</td>
</tr>
`).join('');
}
async function main() {
let sim = new Simulator();
let master = {};
while (true){
const stats = await runAsync(() => sim.simulateMany());
master = mergeObjs(master, stats);
displayMaster(master);
}
}
main();