-
Notifications
You must be signed in to change notification settings - Fork 318
/
index.html
201 lines (177 loc) · 8.97 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
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
<!DOCTYPE html>
<html>
<head>
<title>Elevator Saga - the elevator programming game</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="font-awesome-4.1-1.0/css/font-awesome.min.css" type="text/css" media="all">
<link href='//fonts.googleapis.com/css?family=Oswald:400,700,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="libs/codemirror/codemirror.css">
<link rel="stylesheet" href="libs/codemirror/themes/solarized.css">
<link rel="stylesheet" href="style.css" type="text/css" media="all">
<script type="text/javascript" src="libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="libs/lodash.min.js"></script>
<script type="text/javascript" src="libs/riot.js"></script>
<script type="text/javascript" src="libs/codemirror/codemirror.js"></script>
<script type="text/javascript" src="libs/codemirror/addon/edit/closebrackets.js"></script>
<script type="text/javascript" src="libs/codemirror/mode/javascript/javascript.js"></script>
<script type="text/javascript" src="libs/unobservable.js"></script>
<script type="text/javascript" src="base.js"></script>
<script type="text/javascript" src="movable.js"></script>
<script type="text/javascript" src="floor.js"></script>
<script type="text/javascript" src="user.js"></script>
<script type="text/javascript" src="elevator.js"></script>
<script type="text/javascript" src="interfaces.js"></script>
<script type="text/javascript" src="world.js"></script>
<script type="text/javascript" src="presenters.js"></script>
<script type="text/javascript" src="challenges.js"></script>
<script type="text/javascript" src="fitness.js"></script>
<script type="text/javascript" src="app.js"></script>
<script type="text/template" id="user-template">
<i class="movable fa user fa-{u.displayType} {state}"></i>
</script>
<script type="text/template" id="floor-template">
<div class="floor" style="top: {yPosition}px">
<span class="floornumber">{level}</span>
<span class="buttonindicator">
<i class="fa fa-arrow-circle-up up"></i>
<i class="fa fa-arrow-circle-down down"></i>
</span>
</div>
</script>
<script type="text/template" id="elevator-template">
<div class="elevator movable" style="width: {e.width}px">
<span class="directionindicator directionindicatorup"><i class="fa fa-arrow-circle-up up activated"></i></span>
<span class="floorindicator"><span></span></span>
<span class="directionindicator directionindicatordown"><i class="fa fa-arrow-circle-down down activated"></i></span>
<span class="buttonindicator"></span>
</div>
</script>
<script type="text/template" id="elevatorbutton-template">
<span class="buttonpress">{floorNum}</span>
</script>
<script type="text/template" id="feedback-template">
<div class="feedback">
<h2 class="emphasis-color">{title}</h2>
<p class="emphasis-color">{message}</p>
<a href="{url}" class="emphasis-color">Next challenge <i class="fa fa-caret-right blink" style="text-decoration: blink"></i></a>
</div>
</script>
<script type="text/template" id="challenge-template">
<div class="left">
<h3>Challenge #{num}: {challenge.condition.description}</h3>
</div>
<button class="right startstop unselectable" style="width: 110px">{startButtonText}</button>
<h3 class="right">
<i class="fa fa-minus-square timescale_decrease unselectable"></i>
<span class="emphasis-color" style="display: inline-block; width: 22px; text-align: center">{timeScale}</span>
<i class="fa fa-plus-square timescale_increase unselectable"></i>
</h3>
</script>
<script type="text/template" id="codestatus-template">
<h5 class="error" style="display: {errorDisplay}"><i class="fa fa-warning error-color"></i> There is a problem with your code: {errorMessage}</h5>
</script>
<script type="text/plain" id="default-elev-implementation">
{
init: function(elevators, floors) {
var elevator = elevators[0]; // Let's use the first elevator
// Whenever the elevator is idle (has no more queued destinations) ...
elevator.on("idle", function() {
// let's go to all the floors (or did we forget one?)
elevator.goToFloor(0);
elevator.goToFloor(1);
});
},
update: function(dt, elevators, floors) {
// We normally don't need to do anything here
}
}
</script>
<script type="text/plain" id="devtest-elev-implementation">
{
init: function(elevators, floors) {
var selectElevatorForFloorPickup = function(floorNum) {
return _.max(elevators, function(e) {
return (_.contains(e.destinationQueue, floorNum) ? 4 : 0) +
(-e.destinationQueue.length*e.destinationQueue.length) +
(-e.loadFactor()*e.loadFactor() * 3);
});
};
_.each(floors, function(floor) {
floor.on("down_button_pressed up_button_pressed", function() {
var elevator = selectElevatorForFloorPickup(floor.level);
if(!_.contains(elevator.destinationQueue, floor.level)) {
elevator.goToFloor(floor.level);
}
});
});
_.each(elevators, function(elevator) {
elevator.on("floor_button_pressed", function(floorNum) {
elevator.goToFloor(floorNum);
});
elevator.on("idle", function() {
elevator.goToFloor(0);
});
});
},
update: function(dt, elevators, floors) {
}
}
</script>
</head>
<body>
<div class="container">
<div class="header">
<h1 class="left">Elevator Saga <em class="emphasis-color">The elevator programming game</em></h1>
<a class="right" href="https://github.com/magwo/elevatorsaga/wiki/">Wiki & Solutions</a>
<a class="right" href="documentation.html#docs">Documentation</a>
<a class="right" href="documentation.html">Help</a>
</div>
<noscript>
<h2>Your browser does not appear to support JavaScript. This page contains a browser-based programming game implemented in JavaScript.</h2>
</noscript>
<div class="challenge" style="height: 40px">
</div>
<div class="world">
<div class="feedbackcontainer"></div>
<div class="innerworld">
</div>
<div class="statscontainer">
<div style="top: 20px"><span class="key">Transported</span><span class="value transportedcounter"></span></div>
<div style="top: 40px"><span class="key">Elapsed time</span><span class="value elapsedtime"></span></div>
<div style="top: 60px"><span class="key">Transported/s</span><span class="value transportedpersec"></span></div>
<div style="top: 80px"><span class="key">Avg waiting time</span><span class="value avgwaittime"></span></div>
<div style="top: 100px"><span class="key">Max waiting time</span><span class="value maxwaittime"></span></div>
<div style="top: 120px"><span class="key" title="Number of floors that have been travelled by elevators">Moves</span><span class="value movecount"></span></div>
</div>
</div>
<div class="codestatus"></div>
<div class="code">
<textarea name="Code" id="code"></textarea>
</div>
<button id="button_reset" style="float: left">Reset</button>
<button id="button_resetundo" style="float: left">Undo reset</button>
<button id="button_apply" style="float: right">Apply</button>
<button id="button_save" style="float: right">Save</button>
<span id="save_message" style="float: right"></span>
<span id="fitness_message" style="float: right"></span>
<div style="clear:both;"></div>
<div style="margin-top: 20px">
<h3>Confused? Open the <a href="documentation.html">Help and API documentation</a> page</h3>
</div>
<div class="footer">
<h4>Made by Magnus Wolffelt and contributors</h4>
<h4>Version <span class="emphasis-color">1.6.5</span></h4>
<h4><a href="https://github.com/magwo/elevatorsaga">Source code</a> on GitHub</h4>
<h4><a href="test/index.html">Run tests</a></h4>
</div>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-56810935-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>