-
Notifications
You must be signed in to change notification settings - Fork 2
/
environments-new-environment.html
320 lines (305 loc) · 20.6 KB
/
environments-new-environment.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<div class="container-fluid">
<h2>Environment</h2>
<div class="text-left">
<label>Grid dimensions:</label>
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<div class="col-md-2 col-xs-3">
<input type="number" class="form-control" ng-model="enc.task_env.environment.rows" ng-change="enc.updateDimensions()" ng-class="{'has-error':(enc.task_env.environment.rows|num)<=2}" min="3" max="20" placeholder="Rows" required>
</div>
<div class="col-md-1 col-xs-1 text-center">x</div>
<div class="col-md-2 col-xs-3">
<input type="number" class="form-control" ng-model="enc.task_env.environment.columns" ng-change="enc.updateDimensions()" ng-class="{'has-error':(enc.task_env.environment.columns|num)<=2}" min="3" max="20" placeholder="Columns" required>
</div>
</div>
<br>
<!-- INITIAL RADIO BUTTONS -->
<div class="row" ng-class="{'treadonly':enc.readOnly}" ng-hide="enc.isDynamic()">
<div class="btn-group btn-group-justified">
<label class="btn btn-primary" ng-model="enc.task_env.environment.random_initial_state" btn-radio="false" tooltip="Draw the initial state on the grid below">User-defined initial state</label>
<label class="btn btn-primary" ng-model="enc.task_env.environment.random_initial_state" btn-radio="true" tooltip="Inital state is randomly generated every execution">Random initial state</label>
</div>
</div>
<button type="button" class="btn btn-primary ng-valid ng-dirty ng-valid-parse ng-touched" ng-model="enc.task_env.environment.random_initial_state" btn-checkbox btn-checkbox-true="false" btn-checkbox-false="true" style="margin-bottom: 30px;" ng-show="enc.isDynamic()" ng-class="{'treadonly':enc.readOnly}">User-defined initial state: <b><span ng-hide="enc.task_env.environment.random_initial_state">ON</span><span ng-show="enc.task_env.environment.random_initial_state">OFF</span></b></button>
<!-- INITIAL STATE -->
<div class="panel panel-default animate-only-show" ng-class="{'panel-primary':enc.isDynamic(), 'treadonly':enc.readOnly}" ng-controller="InitialStateMakerController as ismc" ng-hide="enc.task_env.environment.random_initial_state">
<div class="panel-body text-center">
<div class="row">
<span class="pull-right">
View as
<div class="btn-group btn-group margin-10">
<label class="btn btn-default" ng-model="ismc.percept" btn-radio="true" tooltip="Agent">Perception matrix</label>
<label class="btn btn-default" ng-model="ismc.percept" btn-radio="flase" tooltip="Agent">T-World grahics</label>
</div>
</span>
</div>
<br>
<div class="row">
<div class="btn-group btn-group">
<label class="btn btn-default" ng-model="ismc.selected" btn-radio="'A'" tooltip="Agent">
<img ng-if="!ismc.percept" ng-src="imgs/web-app/cell-{{'A'|tcellimg}}.png" class="no-events">
<span ng-if="ismc.percept">A</span>
</label>
<label class="btn btn-default" ng-model="ismc.selected" btn-radio="'#'" tooltip="Obstacle">
<img ng-if="!ismc.percept" ng-src="imgs/web-app/cell-{{'#'|tcellimg}}.png" class="no-events">
<span ng-if="ismc.percept">#</span>
</label>
<label class="btn btn-default" ng-model="ismc.selected" btn-radio="' '" tooltip="Empty cell">
<img ng-if="!ismc.percept" ng-src="imgs/web-app/cell-{{' '|tcellimg}}.png" class="no-events">
<span ng-if="ismc.percept" class="text-white">_</span>
</label>
<label class="btn btn-default" ng-model="ismc.selected" btn-radio="'T'" tooltip="Tile">
<img ng-if="!ismc.percept" ng-src="imgs/web-app/cell-{{'T'|tcellimg}}.png" class="no-events">
<span ng-if="ismc.percept">T</span>
</label>
<label class="btn btn-default" ng-model="ismc.selected" btn-radio="'C'" tooltip="Battery Charger" ng-show="enc.task_env.battery">
<img ng-if="!ismc.percept" ng-src="imgs/web-app/cell-{{'C'|tcellimg}}.png" class="no-events">
<span ng-if="ismc.percept">C</span>
</label>
<label class="btn btn-default text-center" ng-model="ismc.selected" btn-radio="ismc.holeId" tooltip="Hole Cell (Hole id: {{ismc.holeId}})">
<div ng-if="!ismc.percept" class="center transition-400" style="width:32px; height:32px;" ng-style="{'background-color': (ismc.holeId|tcellcolor)}"></div>
<span ng-if="ismc.percept">{{ismc.holeId}}</span>
<span class="center animate-show-3d-top" ng-show="(ismc.selected|tcellimg) == 'hole'">
<button style="font-size:8px" class="btn btn-primary btn-sm glyphicon glyphicon-chevron-left" ng-click="ismc.prevHoleId()"></button>
<button style="font-size:8px" class="btn btn-primary btn-sm glyphicon glyphicon-chevron-right" ng-click="ismc.nextHoleId()"></button>
</span>
</label>
</div>
</div>
<br>
<div class="table-responsive">
<table class="no-selection table-grid center" ng-class="{'percept':ismc.percept}" ng-mouseenter="ismc.mouseEnter()" ng-mouseleave="ismc.mouseLeave()">
<tr ng-repeat="row in ismc.grid() track by $index" style="height:32px;">
<td ng-repeat="cell in row track by $index" ng-mouseenter="ismc.setCell(row, $index)" ng-mousedown="ismc.mouseDown(row, $index)" ng-mouseup="ismc.mouseUp()" style="width:32px;">
<span ng-if="!ismc.percept&&(cell|tcellimg) != 'hole'">
<img ng-if="cell == '#'" ng-src="imgs/web-app/cell-obstacle{{enc.task_env.environment.dynamic.user_static_obstacles&&enc.isDynamic()?'-static':''}}.png" class="no-events" ng-class="{'tdisabled':enc.task_env.environment.dynamic.user_static_obstacles&&enc.isDynamic(), 'transition-600': !ismc.isMouseEnter()}">
<img ng-if="cell == 'T'" ng-src="imgs/web-app/cell-tile{{enc.task_env.environment.dynamic.user_static_tiles&&enc.isDynamic()?'-static':''}}.png" class="no-events" ng-class="{'tdisabled':enc.task_env.environment.dynamic.user_static_tiles&&enc.isDynamic(), 'transition-600': !ismc.isMouseEnter()}">
<img ng-if="(cell != '#')&&(cell != 'T')" ng-src="imgs/web-app/cell-{{cell|tcellimg}}.png" class="no-events">
</span>
<div ng-if="!ismc.percept&&(cell|tcellimg) == 'hole'" style="width:32px; height:32px;" ng-style="{'background-color': (cell|tcellcolor:enc.task_env.environment.dynamic.user_static_holes&&enc.isDynamic())}" tooltip="Hole id: {{cell}}" ng-class="{'transition-600': !ismc.isMouseEnter()}"></div>
<span ng-if="ismc.percept">{{cell}}</span>
</td>
</tr>
</table>
</div>
<div class="panel panel-default" style="margin-top: 30px; margin-left: 100px; margin-right: 100px" ng-show="enc.isDynamic()">
<div class="panel-heading">
<b>Initial State objects that won't be affected by the dynamism</b>
</div>
<div class="text-left panel-body" ng-show="enc.isDynamic()">
<div class="checkbox">
<label><input type="checkbox" ng-model="enc.task_env.environment.dynamic.user_static_obstacles"> Obstacles</label>
</div>
<div class="checkbox">
<label><input type="checkbox" ng-model="enc.task_env.environment.dynamic.user_static_tiles"> Tiles</label>
</div>
<div class="checkbox">
<label><input type="checkbox" ng-model="enc.task_env.environment.dynamic.user_static_holes"> Holes</label>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default animate-only-show" ng-show="enc.task_env.environment.random_initial_state||enc.isDynamic()" ng-class="{'panel-primary':enc.isDynamic()}">
<div class="panel-heading btn-primary" ng-show="enc.isDynamic()">World-evolution knobs</div>
<div class="panel-body">
<label>Hole size (closed interval: {{enc.task_env.environment.holes_size.range}})</label>
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<div class="col-md-10 col-xs-10">
<div class="ui-slider-size" ui-slider="{range: true}" min="1" max="20" ng-model="enc.task_env.environment.holes_size.range"></div>
</div>
<div class="col-md-1 col-xs-10 teditable">
<button class="btn btn-primary glyphicon glyphicon-stats" tooltip="Probability Distribution" ng-show="enc.isRange(enc.task_env.environment.holes_size.range)" ng-click="enc.openProbDistModal(enc.task_env.environment.holes_size)"></button>
</div>
</div>
<br>
<label>Number of Holes (closed interval: {{enc.task_env.environment.num_holes.range}})</label>
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<div class="col-md-10 col-xs-10">
<div class="ui-slider-size" ui-slider="{range: true}" min="0" max="20" ng-model="enc.task_env.environment.num_holes.range"></div>
</div>
<div class="col-md-1 col-xs-10 teditable">
<button class="btn btn-primary glyphicon glyphicon-stats" tooltip="Probability Distribution" ng-show="enc.isRange(enc.task_env.environment.num_holes.range)" ng-click="enc.openProbDistModal(enc.task_env.environment.num_holes)"></button>
</div>
</div>
<br>
<label>Number of obstacles (closed interval: {{enc.task_env.environment.num_obstacles.range}})</label>
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<div class="col-md-10 col-xs-10">
<div class="ui-slider-size" ui-slider="{range: true}" min="0" max="20" ng-model="enc.task_env.environment.num_obstacles.range"></div>
</div>
<div class="col-md-1 col-xs-10 teditable">
<button class="btn btn-primary glyphicon glyphicon-stats" tooltip="Probability Distribution" ng-show="enc.isRange(enc.task_env.environment.num_obstacles.range)" ng-click="enc.openProbDistModal(enc.task_env.environment.num_obstacles)"></button>
</div>
</div>
<br>
<label>Distance of tile from hole cell (closed interval: {{enc.task_env.environment.difficulty.range}})</label>
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<div class="col-md-10 col-xs-10">
<div class="ui-slider-size" ui-slider="{range: true}" min="0" max="20" ng-model="enc.task_env.environment.difficulty.range"></div>
</div>
<div class="col-md-1 col-xs-10 teditable">
<button class="btn btn-primary glyphicon glyphicon-stats" tooltip="Probability Distribution" ng-show="enc.isRange(enc.task_env.environment.difficulty.range)" ng-click="enc.openProbDistModal(enc.task_env.environment.difficulty)"></button>
</div>
</div>
</div>
</div><br>
<div class="panel panel-primary" ng-show="enc.isDynamic()">
<div class="panel-heading">Dynamism knobs</div>
<div class="panel-body">
<label>Rate at which holes appear/disappear (closed interval: {{enc.task_env.environment.dynamic.dynamism.range}})</label>
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<div class="col-md-10 col-xs-10">
<div class="ui-slider-size" ui-slider="{range: true}" min="1" max="60" ng-model="enc.task_env.environment.dynamic.dynamism.range"></div>
</div>
<div class="col-md-1 col-xs-10 teditable">
<button class="btn btn-primary glyphicon glyphicon-stats" tooltip="Probability Distribution" ng-show="enc.isRange(enc.task_env.environment.dynamic.dynamism.range)" ng-click="enc.openProbDistModal(enc.task_env.environment.dynamic.dynamism)"></button>
</div>
</div>
<br>
<label>Rate at which tiles appear/disappear</label><label ng-show="enc.task_env.environment.dynamic.async_tiles_holes" style="margin-left:5px">(closed interval: {{enc.task_env.environment.dynamic.dynamism_tiles.range}})</label>
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<div class="col-md-10 col-xs-10">
<div class="checkbox"><label><input type="checkbox" ng-init="sync_tiles_holes = !enc.task_env.environment.dynamic.async_tiles_holes" ng-model="sync_tiles_holes" ng-change="enc.task_env.environment.dynamic.async_tiles_holes = !sync_tiles_holes"> Synchronized with holes</label></div>
</div>
<span class="animate-show-3d-top" ng-show="enc.task_env.environment.dynamic.async_tiles_holes">
<div class="col-md-10 col-xs-10">
<div class="ui-slider-size" ui-slider="{range: true}" min="1" max="60" ng-model="enc.task_env.environment.dynamic.dynamism_tiles.range"></div>
</div>
<div class="col-md-1 col-xs-10 teditable">
<button class="btn btn-primary glyphicon glyphicon-stats" tooltip="Probability Distribution" ng-show="enc.isRange(enc.task_env.environment.dynamic.dynamism_tiles.range)" ng-click="enc.openProbDistModal(enc.task_env.environment.dynamic.dynamism_tiles)"></button>
</div>
</span>
</div>
<br>
<label>Rate at which obstacles appear/disappear (closed interval: {{enc.task_env.environment.dynamic.hostility.range}})</label>
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<div class="col-md-10 col-xs-10">
<div class="ui-slider-size" ui-slider="{range: true}" min="1" max="60" ng-model="enc.task_env.environment.dynamic.hostility.range"></div>
</div>
<div class="col-md-1 col-xs-10 teditable">
<button class="btn btn-primary glyphicon glyphicon-stats" tooltip="Probability Distribution" ng-show="enc.isRange(enc.task_env.environment.dynamic.hostility.range)" ng-click="enc.openProbDistModal(enc.task_env.environment.dynamic.hostility)"></button>
</div>
</div>
<br>
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<div class="container">
<div class="checkbox">
<label><input type="checkbox" ng-model="enc.task_env.environment.dynamic.hard_bounds"><b> Hard bounds (Do holes have a set or gradually decaying lifetime?).</b></label>
</div>
</div>
</div>
</div>
</div>
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<div class="col-md-6 col-xs-6">
<label>Variability of scores ({{(enc.task_env.environment.scores_variability*100).toFixed(1)}}%)</label><div class="ui-slider-size" ui-slider min="0" max="1" step="0.001" use-decimals ng-model="enc.task_env.environment.scores_variability"></div>
</div>
</div>
<br>
<div class="row" ng-show="enc.isSemidynamic()">
<section ng-class="{'treadonly':enc.readOnly}" ng-if="enc.isDeterministic()">
<label>Scores associated with holes decay in value every {{enc.task_env.environment.dynamic.dynamism.range[0]}} seconds</label>
<div class="col-md-6 col-xs-6">
<div class="ui-slider-size" ui-slider min="1" max="60" step="1" ng-model="enc.task_env.environment.dynamic.dynamism.range[0]" ng-change="enc.task_env.environment.dynamic.dynamism.range[1] = enc.task_env.environment.dynamic.dynamism.range[0]"></div>
</div>
</section>
<section ng-class="{'treadonly':enc.readOnly}" ng-if="!enc.isDeterministic()">
<label>Scores associated with holes decay in value within {{enc.task_env.environment.dynamic.dynamism.range}} seconds</label>
<div class="col-md-6 col-xs-6">
<div class="ui-slider-size" ui-slider="{range: true}" min="1" max="60" step="1" ng-model="enc.task_env.environment.dynamic.dynamism.range"></div>
</div>
<div class="col-md-1 teditable">
<button class="btn btn-primary glyphicon glyphicon-stats teditable" tooltip="Probability Distribution" ng-show="enc.isRange(enc.task_env.environment.dynamic.dynamism.range)" ng-click="enc.openProbDistModal(enc.task_env.environment.dynamic.dynamism)"></button>
</div>
</section>
<br><br><br>
</div>
<div class="row">
<div class="panel panel-primary">
<div class="panel-heading">Final State/T-World ends when...</div>
<div class="panel-body text-center">
<div class="animate-filter" ng-repeat="cond in enc.task_env.environment.final_state">
<div class="row" ng-class="{'treadonly':enc.readOnly}">
<label class="col-md-2">{{cond.name}}</label>
<input ng-if="cond.value.length == undefined" type="number" class="col-md-2" ng-model="cond.value" min="1" ng-class="{'has-error':(cond.value|num)<=0}" required>
<button class="btn btn-primary col-md-2 teditable" ng-click="enc.setFinalLocations(cond)" ng-if="cond.value.length != undefined" ng-class="{'has-error':!cond.value.length}"><span class="glyphicon glyphicon-map-marker"></span> Select</button>
<label class="col-md-2 col-xs-2">Game Result</label>
<div class="col-md-5 col-xs-5">
<select class="form-control" ng-model="cond.result">
<option value="1">neutral (just show table stats)</option>
<option value="2">success</option>
<option value="3">failure</option>
</select>
</div>
<button class="btn btn-danger glyphicon glyphicon-remove" ng-click="enc.removeFinalStateCondition($index)"></button>
</div>
<hr/>
</div>
<button ng-click="enc.openEndConditionsModal('sm')" ng-disabled="!enc.end_game_cond.length||enc.readOnly" class="btn btn-success"><span class="glyphicon glyphicon-plus"></span> Add Condition</button>
</div>
</div>
</div>
</div>
</div>
<script type="text/ng-template" id="final-locations.html">
<div class="modal-header">
<h3 class="modal-title">Location(s) agent(s) have to be located at</h3>
</div>
<div class="modal-body text-center" ng-class="{'treadonly':readOnly}" ng-controller="InitialStateMakerController as ismc" ng-init="ismc.grid = grid; ismc.selected='X'">
<div class="row">
<div class="btn-group btn-group">
<label class="btn btn-primary" ng-model="ismc.selected" btn-radio="'X'" tooltip="Mark">
<img ng-src="imgs/web-app/cell-{{'X'|tcellimg:color}}.png" class="no-events">
</label>
<label class="btn btn-primary" ng-model="ismc.selected" btn-radio="' '" tooltip="Clear cell">
<img ng-src="imgs/web-app/cell-{{' '|tcellimg}}.png" class="no-events">
</label>
</div>
</div>
<br>
<div class="table-responsive">
<table class="no-selection table-grid center">
<tr ng-repeat="row in ismc.grid track by $index" style="height:23px;">
<td ng-repeat="cell in row track by $index" ng-mouseenter="ismc.setCell(row, $index)" ng-mousedown="ismc.mouseDown(row, $index)" ng-mouseup="ismc.mouseUp()" style="width:23px;">
<img ng-src="imgs/web-app/cell-{{cell|tcellimg:color}}.png" class="no-events">
</td>
</tr>
</table>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" ng-click="close()">Cancel</button>
<button class="btn btn-success" ng-click="ok()">OK</button>
</div>
</script>
<script type="text/ng-template" id="end-game-cond.html">
<div class="modal-header">
<h3 class="modal-title">Click on a condition to add it</h3>
</div>
<div class="modal-body text-center">
<button class="btn label label-default" ng-repeat="cond in end_game_cond" ng-if="visible(cond)" ng-click="ok($index)">{{ cond.name }}</button>
</div>
<div class="modal-footer">
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
</div>
</script>
<script type="text/ng-template" id="prob-distrib.html">
<div class="modal-header">
<h3 class="modal-title top-shadow"><span class="glyphicon glyphicon-signal"></span> Probability distribution <small>click on the figure to set it manually!</small></h3>
</div>
<div class="modal-body text-center">
<div class="tprob-bar">
<div class="ui-slider-size vertical axis ui-slider ui-widget ui-widget-content ui-corner-all ui-slider-vertical"></div>
{{knob.range[0]}}
</div>
<div class="tprob-bar" ng-repeat="prob in knob.prob track by $index">
<span tooltip="P({{knob.range[0]+$index}})={{(knob.prob[$index]/1000).toFixed(3)}}" tooltip-placement="bottom">
<div class="ui-slider-size vertical" ng-class="{'treadonly':readOnly}" ui-slider="slider_options" min="0" max="1000" ng-model="knob.prob[$index]"></div>
<span>
</div>
{{knob.range[1]}}
</div>
<div class="modal-footer">
<button class="btn btn-success" ng-click="ok()">Save</button>
</div>
</script>