forked from JimAllanson/lifejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
165 lines (139 loc) · 5.96 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Life.js</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="bootstrap/css/bootstrap.css" rel="stylesheet">
<style>
body {
padding-top: 40px; /* 60px to make the container go all the way to the bottom of the topbar */
overflow:hidden;
}
#controls{
position:absolute;
top:30%;
height:70%;
width:100%;
display:none;
background:white;
opacity:0.8;
}
#fitness{
position:relative;
width:100%;
height:60%;
}
#brain {
position:relative;
float:left;
height: 500px;
width: 500px;
margin: 0px;
padding: 0px;
background: #000;
}
.btn-group{
float:left;
}
</style>
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="bootstrap/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="bootstrap/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="bootstrap/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="bootstrap/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="bootstrap/ico/apple-touch-icon-57-precomposed.png">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="btn-group">
<button class="btn btn-primary" data-toggle="button" id="pause">Pause</button>
<button class="btn" data-toggle="button" id="showControls">Show Advanced Controls</button>
<button class="btn" data-toggle="button" id="enableLogging">Enable Logging</button>
</div>
<div class="btn-group">
<button class="btn btn-success" id="clone">Clone this agent</button>
<button class="btn btn-danger" id="kill">Kill this agent</button>
</div>
</div>
</div>
<div id="sim">
</div>
<div id="controls">
<ul class="nav nav-tabs" id="tabs">
<li class="active"><a href="#charts">Charts</a></li>
<li><a href="#agent">Selected Agent</a></li>
<li><a href="#simulation">Simulation Control</a></li>
<li><a href="#render">Render Settings</a></li>
<li><a href="#help">Help</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="charts">
<div id="fitness" class="maxHeight"></div>
</div>
<div class="tab-pane" id="agent">
<button class="btn" data-toggle="button" id="updateBrainGraph">Update Brain Graph (Slow)</button>
<canvas id="eyes" width="500px" height="500px"></canvas>
<div id="brain"></div>
</div>
<div class="tab-pane" id="simulation">...</div>
<div class="tab-pane" id="render">
<button class="btn btn-primary active" data-toggle="button" id="render_grass">Grass</button>
<div class="btn-group">
<button class="btn btn-primary" data-toggle="button" id="render_viewCones">View Cones</button>
<button class="btn btn-primary active" data-toggle="button" id="render_eyes">Eyes</button>
<button class="btn btn-primary active" data-toggle="button" id="render_indicators">Event Indicators</button>
<button class="btn btn-primary active" data-toggle="button" id="render_health">Health Bars</button>
<button class="btn btn-primary" data-toggle="button" id="render_stats">Stats</button>
</div>
</div>
<div class="tab-pane" id="help">...</div>
</div>
</div>
<!-- /container -->
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="bootstrap/js/jquery.js"></script>
<script src="bootstrap/js/bootstrap-transition.js"></script>
<script src="bootstrap/js/bootstrap-alert.js"></script>
<script src="bootstrap/js/bootstrap-modal.js"></script>
<script src="bootstrap/js/bootstrap-dropdown.js"></script>
<script src="bootstrap/js/bootstrap-scrollspy.js"></script>
<script src="bootstrap/js/bootstrap-tab.js"></script>
<script src="bootstrap/js/bootstrap-tooltip.js"></script>
<script src="bootstrap/js/bootstrap-popover.js"></script>
<script src="bootstrap/js/bootstrap-button.js"></script>
<script src="bootstrap/js/bootstrap-collapse.js"></script>
<script src="bootstrap/js/bootstrap-carousel.js"></script>
<script src="bootstrap/js/bootstrap-typeahead.js"></script>
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<script type="text/javascript" src="jit.js"></script>
<script type="text/javascript" src="Life.js"></script>
<script type="text/javascript" src="LifeUI.js"></script>
<script type="text/javascript">
var simulation, view, ui;
$(document).ready(function(){
var height = document.getElementById("sim").height;
var width = document.getElementById("sim").width;
var parameters = {height: height, width:width, maxAgents:70, tickDuration:1, agent: {babies: 1}};
simulation = new Life.Simulation(parameters);
view = new Life.Renderer(simulation);
simulation.init();
view.init();
document.getElementById("sim").appendChild(view.canvas);
ui = new Life.UI(simulation);
});
</script>
</body>
</html>