-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfacroller.html
More file actions
45 lines (41 loc) · 1.22 KB
/
facroller.html
File metadata and controls
45 lines (41 loc) · 1.22 KB
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
38
39
40
41
42
43
44
45
<html>
<head><title>Fiasco Facilitator roller</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
var rollDice = function() {
return Math.floor(Math.random() * 6) + 1;
};
var rollSetup =function() {
roll(4 * document.getElementById("numplayers").value);
};
var rollTilt = function() {
roll(2 * document.getElementById("numplayers").value);
};
var roll = function(nRolls) {
//var nRolls = 4* document.getElementById("numplayers").value;
var res = {1:0,2:0,3:0,4:0,5:0,6:0};
for (var i = 0; i < nRolls; i++) {
res[rollDice()]++;
}
var output = "";
for (i = 1; i < 7; i++) {
output += (i+",").repeat(res[i]);
}
output = output.slice(0,-1);
document.getElementById("res").innerText = output;
return;
};
</script>
</head>
<body>
<h1>Fiasco Facilitator roller</h1>
<p>Number of players: <select id="numplayers">
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select></p>
<button style = "width: 100%; height:69px; font-size: 1.5em" onclick = "rollSetup();">Roll</button>
<button style = "width: 100%; height:69px; font-size: 1.5em" onclick = "rollTilt();">Roll Tilt</button>
<p id = "res"></p>
</body>
</html>