-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
56 lines (36 loc) · 1.66 KB
/
index.html
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
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html>
<head>
<TITLE> PIG </TITLE>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script>
</head>
<BODY>
<h1> PIG</h1>
<h2> How the simulator works </h3>
Pig is a game for 2 to 6 players. Players take turns rolling a die as many times as they like. If a roll is a 2, 3, 4, 5, or 6, the player adds that many points to their score for the turn. A player may choose to end their turn at any time and “bank” their points. If a player rolls a 1, they lose all their unbanked points and their turn is over.
<p>
Beginner Game: The first player to score 50 or more points wins. Advanced Game: The first player to score 100 or more points wins.
<p>
Players will ultimately develop a strategy in the form roll n times or until hand value is greater than or equal to p.
<p>
<b>N</b> is referred to as the roll limit and <b>p</b> the hand limit.
<div>
<h2> Inputs </h2>
<b>Winning Condition</b> <input id="win_condition" type="number" value="50"/>
<b>Number of Trials in Experiment </b> <input id="num_of_trials" type="number" value="100"/>
<div>
<h3> Player 1 Strategy </h3>
<b>Hand Limit</b> <input id="hl1", type="number" value="12" />
<b>Roll Limit</b> <input id="rl1", type="number" value="5"/>
<div>
<h3> Player 2 Strategy </h3>
<b>Hand Limit</b> <input id="hl2", type="number" value="12"/>
<b>Roll Limit</b> <input id="rl2", type="number" value="5"/>
<div>
<button type="button">Simulate!</button>
<canvas id="chart"></canvas>
<script src="PIG.js">
</script>
<h2 id="playerOneStats"> Player 1 Win Percentage</h2>
<h2 id="playerTwoStats">Player 2 Win Percentage </h2>
</BODY>