-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
167 lines (154 loc) · 7.11 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Simulating Elections</title>
<meta name="description" content="Simulating Elections" />
<meta name="author" content="frcroth" />
<link rel="icon" type="image/x-icon" href="assets/election-icon.png" />
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous" />
<link rel="stylesheet" href="css/custom.css" />
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Lato&display=swap" rel="stylesheet" />
</head>
<body>
<div class="row head-row">
<div class="col-lg">
<h1>Simulating elections</h1>
</div>
<div class="col-sm" id="quote-box">
<q class="quote">I consider it completely unimportant who in the party will
vote, or how; but what is extraordinarily important is this
— who will count the votes, and how.</q>
- Stalin
</div>
</div>
<hr />
<p>
This is the political coordinate system. While a crude model to
depict real politics, it will suffice for our simulations. Each
person's political views are represented by a position in the
coordinate system. This applies to voters and candidates.
<br />
Start by drawing voters and candidates by clicking at the position,
or generate random people. You can use a preset instead of drawing
to get differing results. Every voter wants to vote for the
candidate that has the closest distance to them. Try out different
voting systems by clicking on the appropriate buttons. With
different electoral systems, the same results may be interpreted to
result in different winners.
</p>
<hr />
<div class="form-row">
<div class="col">
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="one-seat-radio" name="multiOneSeatRadio" class="custom-control-input"
checked="true" />
<label class="custom-control-label" for="one-seat-radio">One seat</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="multi-seat-radio" name="multiOneSeatRadio" class="custom-control-input" />
<label class="custom-control-label" for="multi-seat-radio">Multiple seats</label>
</div>
</div>
<div class="col">
<div class="form-inline">
<label for="seatCountInput">Number of seats</label>
<input type="Number" id="seatCountInput" value="10" min="1" disabled="true" autocomplete="off" />
</div>
</div>
<div class="col">
<div class="form-inline">
<label for="electionThresholdInput">Election threshold</label>
<input type="Number" id="electionThresholdInput" value="0" min="0" max="30" disabled="true" />
<label>%</label>
</div>
</div>
</div>
<hr />
<div class="row main-row">
<div class="col-sm" id="coordinate-system-col">
<div id="coordinate-system-box">
<canvas id="coordinate-system">
Your browser does not support the HTML canvas tag.
</canvas>
</div>
<div>
<p>Add points: Voters and candidates</p>
<div class="row" style="margin: auto">
<div class="list-group">
<a href="javascript:void(0);" id="voters-menu-item"
class="list-group-item list-group-item-action active"
onclick="coordinateSystem.setDrawMode(0)">Draw Voters</a>
<a href="javascript:void(0);" id="candidates-menu-item"
class="list-group-item list-group-item-action"
onclick="coordinateSystem.setDrawMode(1)">Draw candidates</a>
</div>
<div>
<button onclick="coordinateSystem.generateRandomPoints()" class="btn btn-secondary">
Generate random points
</button>
</div>
<div class="dropdown show">
<a class="btn btn-secondary dropdown-toggle" href="javascript:void(0);" role="button"
id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Presets
</a>
<div id="preset-dropdown" class="dropdown-menu" aria-labelledby="dropdownMenuLink">
</div>
</div>
<div>
<button onclick="document.electionSimulation.resetModel()" class="btn btn-secondary">
Reset
</button>
</div>
</div>
</div>
</div>
<div class="col-sm" id="central-column"></div>
<div class="col-sm" id="result-column">
<div id="election-result-text"></div>
<div id="election-results" class="card">
<div id = "election-results-parliament"></div>
<canvas id="diagram-canvas" width="600" height="400"></canvas>
</div>
</div>
<div id="additional-results" class="col-m"></div>
</div>
<hr />
<p>
This system assumes that each voter votes exactly for the candidate
that is closest to their positions. It also assumes that voters fill
out ballots with all possible alternatives.
</p>
<hr />
<div> </div>
</br></br>
<footer class="footer">
<div class="row">
<div class="col-sm">
<span class="text-muted">Election simulation by
<a href="http://frcroth.de">frcroth</a></span>
</div>
<div class="col-s">
<span class="text-muted">See
<a href="http://github.com/frcroth/elections">code</a></span>
</div>
</div>
</footer>
<!-- BOOTSTRAP -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
<!-- Chart.js -->
</body>
</html>