-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathscaling.html
41 lines (35 loc) · 1.01 KB
/
scaling.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
<!DOCTYPE html>
<html>
<head>
<script src="js/util.js?v=0"></script>
</head>
<body>
<script type="text/javascript">
var alpha = 0.450;
var filename = "zombies-alpha-"+alpha+".json";
var worker = new Array();
var all = new Array();
function launch(i){
if (worker[i]) worker[i].terminate();
worker[i] = new Worker("js/worker-sim.js?v=0");
worker[i].postMessage({"cmd": "run", "alpha": alpha, "mu": 1, "szr": true});
worker[i].onmessage = function warp(id){
return function(e) {
if (e.data['cmd'] == 'report'){
var n = e.data['N']; var l = e.data['L'];
console.log(id+": "+l+", "+n);
all.push([l,n]);
setTimeout(function(){launch(id);}, 20);
}
}
}(i);
}
function dodl() {download(all, filename);}
launch(0);
launch(1);
launch(2);
launch(3);
</script>
<input type='button' value='download' style='position: absolute; top: 0px; left: 0px;' onclick="dodl();"/>
</body>
</html>