-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathag.html
57 lines (44 loc) · 1.84 KB
/
ag.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Resta 1</title>
<script src="js/lib/jquery/jquery-1.4.4.min.js"></script>
<script src="js/lib/underscore.js"></script>
<script src="js/lib/d3.js"></script>
<script src="js/src/Utils.js"></script>
<script src="js/src/Resta1.js"></script>
<script src="js/src/AG.js"></script>
<script src="js/src/Busca.js"></script>
<script src="js/src/FastTests.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/styles.css" />
<style>svg { margin: 2px; }</style>
</head>
<body>
<script>
var board, worker;
$(document).ready(function(){
console.time('amostra');
worker = new Worker('js/src/AGWebWorker.js');
worker.addEventListener('message', function(e) {
console.log('Worker respondeu');
if (e.data.amostra)
handleAmostra(new AG.Amostra(e.data.amostra));
else
console.log(e.data);
}, false);
worker.onerror = function(event){
console.error(event);
};
worker.postMessage('inicia');
});
function handleAmostra(amostra) {
board = new Resta1.Board({width: 120, height: 120, sequence: amostra.melhorIndividuo.genoma, compactView: true});
console.log("Geracao:", amostra.geracao);
amostra.forEach(function(individuo){ console.log("(", individuo.fitness, ")", individuo.genoma, individuo.diversidade); });
console.timeEnd('amostra'); console.time('amostra');
//$('body').hide(1, function(){ $('body').show() });
}
</script>
</body>
</html>