-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
69 lines (56 loc) · 2.63 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Falling Balls</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/matter-js/0.12.0/matter.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"> </script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="mt-5 text-center">
<h1>Falling Balls + DQN</h1>
</div>
<div class="mt-3 col-sm-12 text-center">
<p>A demo of a DQN agent that learns to dodge falling balls, inspired by an old iPhone game.<br>The game utilizes <a href="http://brm.io/matter-js/">Matter.js</a> while the neural network is built with <a href="https://js.tensorflow.org/">TensorFlow.js</a>.<br>Hyperparameters and settings can be edited below. Code and further details are on <a href="https://github.com/seann999/dodge_tfjs">GitHub</a>.</p>
</div>
<div class="mt-5">
<canvas id="world"></canvas>
</div>
<div class="mt-3 flex">
<form class="form-inline">
<button id='start' type="button" class="btn btn-primary" onclick="toggleTrain();">Start</button>
<button id='reset' type="button" class="btn btn-primary" onclick="resetSignal();">Stop</button>
<div>
<label for="speed">Play Speed</label>
<input type="range" min="-100" max="20" value="0" class="slider" id="speed">
</div>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input id="showSensors" type="checkbox" class="form-check-input" value="">Show sensors
</label>
</div>
<div class="form-check form-check-inline">
<label class="form-check-label">
<input id="manualControl" type="checkbox" class="form-check-input" value="">Manual control
</label>
</div>
</form>
</div>
<div class="flex">
<div id="scoreChart" style="height: 300px; width: 80%;"></div>
<!--<div id="lossChart" style="height: 300px; width: 100%;"></div>
<div id="timeChart" style="height: 300px; width: 100%;"></div>-->
</div>
<div class="mt-5 mb-5">
<textarea class="form-control" rows="10" id="settings"></textarea>
</div>
</div>
<script src="world.js"></script>
<script src="agent.js"></script>
<script src="draw.js"></script>
</body>
</html>