-
Notifications
You must be signed in to change notification settings - Fork 0
/
replay.html
58 lines (58 loc) · 1.58 KB
/
replay.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
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<style>
body {
background: #f9f9f9;
font-family: sans-serif;
font-size: 10pt;
}
#acsg {
display: none;
}
#data {
font-family: monospace;
}
label {
font-weight: bold;
}
</style>
<div id="acsg">
<p><code><span id="score">0</span> points, <span id="clock">1</span> s remaining</code></p>
</div>
<form id="enter-data">
<label>Compressed Experiment Data</label>
<p>Paste the actions and timestamps data from a previous run into the text box below.</p>
<br/>
<textarea id="data" rows="20" cols="80"></textarea>
<br/>
<button id="run" value="Run">Real-time</button> Watch the action as it happened.</br>
<button id="run-fast" value="Run">Express</button> Generate the uncompressed data set as fast as possible.
</form>
</body>
<script src="acsg-dist.js"></script>
<script>
function runGame(config) {
document.getElementById('enter-data').style.display = 'none'
document.getElementById('acsg').style.display = 'block'
game = acsg.Game(config)
game.run(function () {
game.exportFullGameData()
})
}
document.getElementById('run').onclick = function (event) {
var config = JSON.parse(document.getElementById("data").value)
config.config.REAL_TIME = true
runGame(config)
event.preventDefault()
};
document.getElementById('run-fast').onclick = function (event) {
var config = JSON.parse(document.getElementById("data").value)
config.config.REAL_TIME = false
runGame(config)
event.preventDefault()
};
</script>
</html>