-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
303 lines (302 loc) · 11.5 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/p5.js"></script>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<link rel="stylesheet" href="./styles/main.css" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<title>Evolution Simulator</title>
</head>
<body>
<section id="tabs">
<div class="container">
<ul class="nav nav-tabs" style="margin-top: 2rem" role="tablist">
<li class="nav-item h3">
<a
class="nav-link active"
data-bs-toggle="tab"
href="#how"
role="tab"
>
How it works
</a>
</li>
<li class="nav-item h3">
<a
class="nav-link"
data-bs-toggle="tab"
href="#simulation"
role="tab"
>
Simulation
</a>
</li>
<li class="nav-item h3">
<a class="nav-link" data-bs-toggle="tab" href="#graph" role="tab">
Graph
</a>
</li>
<li class="nav-item h3">
<a
class="nav-link"
data-bs-toggle="tab"
href="#settings"
role="tab"
>
Settings
</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="how" role="how">
<div class="d-flex flex-column justify-content-between">
<h1 class="text-center mt-4">What is Evolution</h1>
<span class="h4">
There are four principles at work in evolution, variation,
inheritance, selection, time</span
>
<div class="d-flex flex-row justify-content-between mt-4">
<div
class="card"
style="width: 23%; background-color: cornflowerblue"
>
<div class="card-body">
<h4 class="card-title">Variation</h4>
<p class="card-text">
Variation is the process by which new genetic material is
introduced into a population.
</p>
</div>
</div>
<div
class="card"
style="width: 23%; background-color: cornflowerblue"
>
<div class="card-body">
<h4 class="card-title">Inheritance</h4>
<p class="card-text">
Inheritance is the process by which genetic material is
passed from one generation to the next.
</p>
</div>
</div>
<div
class="card"
style="width: 23%; background-color: cornflowerblue"
>
<div class="card-body">
<h4 class="card-title">Selection</h4>
<p class="card-text">
Selection is the process by which individuals that have
inherited favourable traits produce more offspring than
individuals that have not.
</p>
</div>
</div>
<div
class="card"
style="width: 23%; background-color: cornflowerblue"
>
<div class="card-body">
<h4 class="card-title">Time</h4>
<p class="card-text">
Time is the process by which the process of evolution
occurs.
</p>
</div>
</div>
</div>
</div>
<div class="d-flex flex-column justify-content-between">
<h1 class="text-center mt-4">How it works</h1>
<span class="h4"> This is a simulation of evolution. </span>
<div class="d-flex flex-row justify-content-between mt-4">
<div
class="card"
style="width: 30%; background-color: rgb(228, 184, 152)"
>
<div class="card-body">
<h1 class="card-title h3 text-body fw-bolder">
Simulation
</h1>
<p class="card-text">
<li class="text-body fw-bolder">
Green area is where creatures can produce.
</li>
<li class="text-body fw-bolder">
You can view creatures in the simulation tab.
</li>
<li class="text-body fw-bolder">
Click start to see the creatures evolve.
</li>
<li class="text-body fw-bolder">
or click next to see the next generation.
</li>
</p>
</div>
</div>
<div
class="card"
style="width: 30%; background-color: rgb(105, 138, 198)"
>
<div class="card-body">
<h4 class="card-title h3 text-body fw-bolder">Graph</h4>
<p class="card-text">
<li class="text-body fw-bolder">
You can view the graph in the graph tab.
</li>
<li class="text-body fw-bolder">
The graph shows the population of each creature.
</li>
<li class="text-body fw-bolder">
The graph also shows how many creatures produced(blue),
died(red) and did not produce(gray).
</li>
</p>
</div>
</div>
<div
class="card"
style="width: 30%; background-color: rgb(179, 226, 128)"
>
<div class="card-body">
<h4 class="card-title h3 text-body fw-bolder">Settings</h4>
<p class="card-text text-body fw-bolder">
<li class="text-body fw-bolder">
Change number of creatures.(Required reset)
</li>
<li class="text-body fw-bolder">
Change brain size of creatures.(Required reset)
</li>
<li class="text-body fw-bolder">
Change number of genes in the creatures brain.(Required
reset)
</li>
<li class="text-body fw-bolder">
Change decision threshold.
</li>
</p>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane mt-4" id="simulation" role="tabpanel">
<main></main>
<div class="d-flex flex-row justify-content-start">
<button class="btn btn-dark resetButton">Reset</button>
<button class="btn btn-dark playButton">Play</button>
<button class="btn btn-dark nextButton">Next</button>
<button class="btn btn-dark addWallButton">Add Wall</button>
</div>
</div>
<div class="tab-pane mt-4" id="graph" role="graph">
<div class="d-flex flex-row justify-content-start">
<button class="btn btn-dark resetButton">Reset</button>
<button class="btn btn-dark playButton">Play</button>
<button class="btn btn-dark nextButton">Next</button>
</div>
</div>
<div class="tab-pane" id="settings" role="settings">
<h2
class="h1"
style="text-align: center; margin: 2rem"
id="generation"
></h2>
<div
class="d-flex flex-row justify-content-around"
style="align-items: center"
>
<button class="btn btn-dark resetButton">Reset</button>
<div class="d-flex flex-row">
<label for="fitnessFunctionSelect" style="margin-right: 1rem"
>Fitness Function:
</label>
<select id="fitnessFunctionSelect"></select>
</div>
<div class="d-flex flex-row" style="margin-left: 0.2rem">
<label for="creatureNumber" style="margin-right: 1rem"
>Creature Number:
</label>
<input type="number" id="creatureNumber" value="100" />
</div>
<div class="d-flex flex-row" style="margin-left: 0.2rem">
<label for="optimizeGraph" style="margin-right: 1rem"
>Optimize Graph:
</label>
<input type="checkbox" id="optimizeGraph" checked="true" />
</div>
</div>
<div id="sliderInputs">
<div class="sliderInput">
<label id="mutationRate" for="mutationRateSlider"
>Mutation: 0.05</label
>
<input
type="range"
id="mutationRateSlider"
min="0"
max="1000"
value="50"
orient="vertical"
class="slider"
/>
</div>
<div class="sliderInput">
<label id="brainSize" for="brainSizeSlider">Brain 6</label>
<input
type="range"
id="brainSizeSlider"
min="1"
max="10"
value="6"
class="slider"
/>
</div>
<div class="sliderInput">
<label id="geneNumber" for="geneNumberSlider"
>Gene Number 20</label
>
<input
type="range"
id="geneNumberSlider"
min="1"
max="100"
value="20"
class="slider"
/>
</div>
<div class="sliderInput">
<label id="decisionThreshold" for="decisionThresholdSlider"
>Threshold 0.4</label
>
<input
type="range"
id="decisionThresholdSlider"
min="1"
max="100"
value="40"
class="slider"
/>
</div>
</div>
</div>
</div>
</div>
</section>
<script src="./scripts/sketch.js"></script>
<script src="./scripts/creature.js"></script>
<script src="./scripts/gene.js"></script>
<script src="./scripts/brain.js"></script>
<script src="./scripts/chart.js"></script>
<script src="./scripts/simulation.js"></script>
<script src="./scripts/neuron.js"></script>
<script src="./scripts/constants.js"></script>
<script src="./scripts/eventHandler.js"></script>
</body>
</html>