the-swarm 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/.yardopts +8 -0
  4. data/Gemfile +24 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +35 -0
  7. data/Rakefile +26 -0
  8. data/bin/swarm +11 -0
  9. data/docs/Swarm.html +296 -0
  10. data/docs/Swarm/Catalog.html +819 -0
  11. data/docs/Swarm/Console.html +1050 -0
  12. data/docs/Swarm/Console/Color.html +160 -0
  13. data/docs/Swarm/Console/NormalKey.html +410 -0
  14. data/docs/Swarm/Console/PopUp.html +236 -0
  15. data/docs/Swarm/Console/VIKey.html +410 -0
  16. data/docs/Swarm/Five.html +421 -0
  17. data/docs/Swarm/Four.html +389 -0
  18. data/docs/Swarm/Game.html +1197 -0
  19. data/docs/Swarm/Intro.html +419 -0
  20. data/docs/Swarm/Level.html +700 -0
  21. data/docs/Swarm/Map.html +2336 -0
  22. data/docs/Swarm/One.html +353 -0
  23. data/docs/Swarm/Three.html +383 -0
  24. data/docs/Swarm/Tile.html +3823 -0
  25. data/docs/Swarm/Two.html +355 -0
  26. data/docs/_index.html +313 -0
  27. data/docs/class_list.html +51 -0
  28. data/docs/css/common.css +1 -0
  29. data/docs/css/full_list.css +58 -0
  30. data/docs/css/style.css +492 -0
  31. data/docs/file.LICENSE.html +70 -0
  32. data/docs/file.README.html +101 -0
  33. data/docs/file_list.html +61 -0
  34. data/docs/frames.html +17 -0
  35. data/docs/index.html +101 -0
  36. data/docs/js/app.js +248 -0
  37. data/docs/js/full_list.js +216 -0
  38. data/docs/js/jquery.js +4 -0
  39. data/docs/method_list.html +1195 -0
  40. data/docs/top-level-namespace.html +110 -0
  41. data/lib/swarm.rb +60 -0
  42. data/lib/swarm/catalog.rb +71 -0
  43. data/lib/swarm/console.rb +165 -0
  44. data/lib/swarm/game.rb +173 -0
  45. data/lib/swarm/level.rb +58 -0
  46. data/lib/swarm/levels/five.rb +71 -0
  47. data/lib/swarm/levels/four.rb +55 -0
  48. data/lib/swarm/levels/intro.rb +36 -0
  49. data/lib/swarm/levels/one.rb +35 -0
  50. data/lib/swarm/levels/three.rb +51 -0
  51. data/lib/swarm/levels/two.rb +38 -0
  52. data/lib/swarm/map.rb +254 -0
  53. data/lib/swarm/tile.rb +149 -0
  54. data/lib/swarm/version.rb +5 -0
  55. data/swarm.gemspec +24 -0
  56. metadata +112 -0
@@ -0,0 +1,419 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Swarm::Intro
8
+
9
+ &mdash; &quot;Swarm&quot; Source Code Documentation
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Swarm::Intro";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (I)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Swarm.html" title="Swarm (module)">Swarm</a></span></span>
41
+ &raquo;
42
+ <span class="title">Intro</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Swarm::Intro
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="Level.html" title="Swarm::Level (class)">Level</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="Level.html" title="Swarm::Level (class)">Level</a></span></li>
78
+
79
+ <li class="next">Swarm::Intro</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/swarm/levels/intro.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+ <h2>
113
+ Instance Method Summary
114
+ <small><a href="#" class="summary_toggle">collapse</a></small>
115
+ </h2>
116
+
117
+ <ul class="summary">
118
+
119
+ <li class="public ">
120
+ <span class="summary_signature">
121
+
122
+ <a href="#over%3F-instance_method" title="#over? (instance method)">#<strong>over?</strong> &#x21d2; Boolean </a>
123
+
124
+
125
+
126
+ </span>
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+ <span class="summary_desc"><div class='inline'></div></span>
137
+
138
+ </li>
139
+
140
+
141
+ <li class="public ">
142
+ <span class="summary_signature">
143
+
144
+ <a href="#play-instance_method" title="#play (instance method)">#<strong>play</strong> &#x21d2; Object </a>
145
+
146
+
147
+
148
+ </span>
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+ <span class="summary_desc"><div class='inline'></div></span>
159
+
160
+ </li>
161
+
162
+
163
+ <li class="public ">
164
+ <span class="summary_signature">
165
+
166
+ <a href="#setup-instance_method" title="#setup (instance method)">#<strong>setup</strong> &#x21d2; Object </a>
167
+
168
+
169
+
170
+ </span>
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+ <span class="summary_desc"><div class='inline'></div></span>
181
+
182
+ </li>
183
+
184
+
185
+ <li class="public ">
186
+ <span class="summary_signature">
187
+
188
+ <a href="#show-instance_method" title="#show (instance method)">#<strong>show</strong>(*args) &#x21d2; Object </a>
189
+
190
+
191
+
192
+ </span>
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <span class="summary_desc"><div class='inline'></div></span>
203
+
204
+ </li>
205
+
206
+
207
+ </ul>
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Level.html" title="Swarm::Level (class)">Level</a></span></h3>
220
+ <p class="inherited"><span class='object_link'><a href="Level.html#each-class_method" title="Swarm::Level.each (method)">each</a></span>, <span class='object_link'><a href="Level.html#find_player-instance_method" title="Swarm::Level#find_player (method)">#find_player</a></span>, <span class='object_link'><a href="Level.html#initialize-instance_method" title="Swarm::Level#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Level.html#move-instance_method" title="Swarm::Level#move (method)">#move</a></span>, <span class='object_link'><a href="Level.html#move_player-instance_method" title="Swarm::Level#move_player (method)">#move_player</a></span>, <span class='object_link'><a href="Level.html#spawn_player-instance_method" title="Swarm::Level#spawn_player (method)">#spawn_player</a></span>, <span class='object_link'><a href="Level.html#update-instance_method" title="Swarm::Level#update (method)">#update</a></span>, <span class='object_link'><a href="Level.html#update!-instance_method" title="Swarm::Level#update! (method)">#update!</a></span></p>
221
+ <div id="constructor_details" class="method_details_list">
222
+ <h2>Constructor Details</h2>
223
+
224
+ <p class="notice">This class inherits a constructor from <span class='object_link'><a href="Level.html#initialize-instance_method" title="Swarm::Level#initialize (method)">Swarm::Level</a></span></p>
225
+
226
+ </div>
227
+
228
+
229
+ <div id="instance_method_details" class="method_details_list">
230
+ <h2>Instance Method Details</h2>
231
+
232
+
233
+ <div class="method_details first">
234
+ <h3 class="signature first" id="over?-instance_method">
235
+
236
+ #<strong>over?</strong> &#x21d2; <tt>Boolean</tt>
237
+
238
+
239
+
240
+
241
+
242
+ </h3><div class="docstring">
243
+ <div class="discussion">
244
+
245
+
246
+ </div>
247
+ </div>
248
+ <div class="tags">
249
+
250
+ <p class="tag_title">Returns:</p>
251
+ <ul class="return">
252
+
253
+ <li>
254
+
255
+
256
+ <span class='type'>(<tt>Boolean</tt>)</span>
257
+
258
+
259
+
260
+ </li>
261
+
262
+ </ul>
263
+
264
+ </div><table class="source_code">
265
+ <tr>
266
+ <td>
267
+ <pre class="lines">
268
+
269
+
270
+ 31
271
+ 32
272
+ 33</pre>
273
+ </td>
274
+ <td>
275
+ <pre class="code"><span class="info file"># File 'lib/swarm/levels/intro.rb', line 31</span>
276
+
277
+ <span class='kw'>def</span> <span class='id identifier rubyid_over?'>over?</span>
278
+ <span class='ivar'>@over</span>
279
+ <span class='kw'>end</span></pre>
280
+ </td>
281
+ </tr>
282
+ </table>
283
+ </div>
284
+
285
+ <div class="method_details ">
286
+ <h3 class="signature " id="play-instance_method">
287
+
288
+ #<strong>play</strong> &#x21d2; <tt>Object</tt>
289
+
290
+
291
+
292
+
293
+
294
+ </h3><table class="source_code">
295
+ <tr>
296
+ <td>
297
+ <pre class="lines">
298
+
299
+
300
+ 3
301
+ 4
302
+ 5</pre>
303
+ </td>
304
+ <td>
305
+ <pre class="code"><span class="info file"># File 'lib/swarm/levels/intro.rb', line 3</span>
306
+
307
+ <span class='kw'>def</span> <span class='id identifier rubyid_play'>play</span>
308
+ <span class='ivar'>@over</span> <span class='op'>=</span> <span class='kw'>true</span>
309
+ <span class='kw'>end</span></pre>
310
+ </td>
311
+ </tr>
312
+ </table>
313
+ </div>
314
+
315
+ <div class="method_details ">
316
+ <h3 class="signature " id="setup-instance_method">
317
+
318
+ #<strong>setup</strong> &#x21d2; <tt>Object</tt>
319
+
320
+
321
+
322
+
323
+
324
+ </h3><table class="source_code">
325
+ <tr>
326
+ <td>
327
+ <pre class="lines">
328
+
329
+
330
+ 27
331
+ 28
332
+ 29</pre>
333
+ </td>
334
+ <td>
335
+ <pre class="code"><span class="info file"># File 'lib/swarm/levels/intro.rb', line 27</span>
336
+
337
+ <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
338
+ <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_center'>center</span><span class='period'>.</span><span class='id identifier rubyid_player!'>player!</span>
339
+ <span class='kw'>end</span></pre>
340
+ </td>
341
+ </tr>
342
+ </table>
343
+ </div>
344
+
345
+ <div class="method_details ">
346
+ <h3 class="signature " id="show-instance_method">
347
+
348
+ #<strong>show</strong>(*args) &#x21d2; <tt>Object</tt>
349
+
350
+
351
+
352
+
353
+
354
+ </h3><table class="source_code">
355
+ <tr>
356
+ <td>
357
+ <pre class="lines">
358
+
359
+
360
+ 7
361
+ 8
362
+ 9
363
+ 10
364
+ 11
365
+ 12
366
+ 13
367
+ 14
368
+ 15
369
+ 16
370
+ 17
371
+ 18
372
+ 19
373
+ 20
374
+ 21
375
+ 22
376
+ 23
377
+ 24
378
+ 25</pre>
379
+ </td>
380
+ <td>
381
+ <pre class="code"><span class="info file"># File 'lib/swarm/levels/intro.rb', line 7</span>
382
+
383
+ <span class='kw'>def</span> <span class='id identifier rubyid_show'>show</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
384
+ <span class='ivar'>@over</span> <span class='op'>=</span> <span class='kw'>false</span>
385
+ <span class='id identifier rubyid_pause'>pause</span> <span class='kw'>do</span> <span class='heredoc_beg'>&lt;&lt;-POPUP</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[ ]{10}</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='op'>%</span> <span class='const'><span class='object_link'><a href="Console.html" title="Swarm::Console (module)">Console</a></span></span><span class='period'>.</span><span class='id identifier rubyid_key_info'><span class='object_link'><a href="Console.html#key_info-instance_method" title="Swarm::Console#key_info (method)">key_info</a></span></span>
386
+ <span class='tstring_content'> Swarm Instructions
387
+ ----------------------------------------------
388
+ Movement:
389
+ north: %&lt;north&gt;s
390
+ south: %&lt;south&gt;s
391
+ west: %&lt;west&gt;s
392
+ east: %&lt;east&gt;s
393
+
394
+ Pause: %&lt;pause&gt;s
395
+ Quit: %&lt;quit&gt;s
396
+ ----------------------------------------------
397
+
398
+ Press %&lt;pause&gt;s to begin.
399
+ </span><span class='heredoc_end'> POPUP
400
+ </span> <span class='kw'>end</span>
401
+ <span class='kw'>end</span></pre>
402
+ </td>
403
+ </tr>
404
+ </table>
405
+ </div>
406
+
407
+ </div>
408
+
409
+ </div>
410
+
411
+ <div id="footer">
412
+ Generated on Wed Aug 30 07:17:59 2017 by
413
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
414
+ 0.9.9 (ruby-2.4.1).
415
+ </div>
416
+
417
+ </div>
418
+ </body>
419
+ </html>
@@ -0,0 +1,700 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Swarm::Level
8
+
9
+ &mdash; &quot;Swarm&quot; Source Code Documentation
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Swarm::Level";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (L)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Swarm.html" title="Swarm (module)">Swarm</a></span></span>
41
+ &raquo;
42
+ <span class="title">Level</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Swarm::Level
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Swarm::Level</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/swarm/level.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <div id="subclasses">
103
+ <h2>Direct Known Subclasses</h2>
104
+ <p class="children"><span class='object_link'><a href="Five.html" title="Swarm::Five (class)">Five</a></span>, <span class='object_link'><a href="Four.html" title="Swarm::Four (class)">Four</a></span>, <span class='object_link'><a href="Intro.html" title="Swarm::Intro (class)">Intro</a></span>, <span class='object_link'><a href="One.html" title="Swarm::One (class)">One</a></span>, <span class='object_link'><a href="Three.html" title="Swarm::Three (class)">Three</a></span>, <span class='object_link'><a href="Two.html" title="Swarm::Two (class)">Two</a></span></p>
105
+ </div>
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+ <h2>
115
+ Class Method Summary
116
+ <small><a href="#" class="summary_toggle">collapse</a></small>
117
+ </h2>
118
+
119
+ <ul class="summary">
120
+
121
+ <li class="public ">
122
+ <span class="summary_signature">
123
+
124
+ <a href="#each-class_method" title="each (class method)">.<strong>each</strong>(&amp;block) &#x21d2; Object </a>
125
+
126
+
127
+
128
+ </span>
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+ <span class="summary_desc"><div class='inline'></div></span>
139
+
140
+ </li>
141
+
142
+
143
+ </ul>
144
+
145
+ <h2>
146
+ Instance Method Summary
147
+ <small><a href="#" class="summary_toggle">collapse</a></small>
148
+ </h2>
149
+
150
+ <ul class="summary">
151
+
152
+ <li class="public ">
153
+ <span class="summary_signature">
154
+
155
+ <a href="#find_player-instance_method" title="#find_player (instance method)">#<strong>find_player</strong> &#x21d2; Object </a>
156
+
157
+
158
+
159
+ </span>
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+ <span class="summary_desc"><div class='inline'></div></span>
170
+
171
+ </li>
172
+
173
+
174
+ <li class="public ">
175
+ <span class="summary_signature">
176
+
177
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> &#x21d2; Level </a>
178
+
179
+
180
+
181
+ </span>
182
+
183
+
184
+ <span class="note title constructor">constructor</span>
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+ <span class="summary_desc"><div class='inline'>
194
+ <p>A new instance of Level.</p>
195
+ </div></span>
196
+
197
+ </li>
198
+
199
+
200
+ <li class="public ">
201
+ <span class="summary_signature">
202
+
203
+ <a href="#move-instance_method" title="#move (instance method)">#<strong>move</strong>(tile, direction) &#x21d2; Object </a>
204
+
205
+
206
+
207
+ </span>
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+ <span class="summary_desc"><div class='inline'></div></span>
218
+
219
+ </li>
220
+
221
+
222
+ <li class="public ">
223
+ <span class="summary_signature">
224
+
225
+ <a href="#move_player-instance_method" title="#move_player (instance method)">#<strong>move_player</strong>(direction) &#x21d2; Object </a>
226
+
227
+
228
+
229
+ </span>
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+ <span class="summary_desc"><div class='inline'></div></span>
240
+
241
+ </li>
242
+
243
+
244
+ <li class="public ">
245
+ <span class="summary_signature">
246
+
247
+ <a href="#over%3F-instance_method" title="#over? (instance method)">#<strong>over?</strong> &#x21d2; Boolean </a>
248
+
249
+
250
+
251
+ </span>
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+ <span class="summary_desc"><div class='inline'></div></span>
262
+
263
+ </li>
264
+
265
+
266
+ <li class="public ">
267
+ <span class="summary_signature">
268
+
269
+ <a href="#spawn_player-instance_method" title="#spawn_player (instance method)">#<strong>spawn_player</strong> &#x21d2; Object </a>
270
+
271
+
272
+
273
+ </span>
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+ <span class="summary_desc"><div class='inline'></div></span>
284
+
285
+ </li>
286
+
287
+
288
+ <li class="public ">
289
+ <span class="summary_signature">
290
+
291
+ <a href="#update-instance_method" title="#update (instance method)">#<strong>update</strong> &#x21d2; Object </a>
292
+
293
+
294
+
295
+ </span>
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+ <span class="summary_desc"><div class='inline'></div></span>
306
+
307
+ </li>
308
+
309
+
310
+ <li class="public ">
311
+ <span class="summary_signature">
312
+
313
+ <a href="#update!-instance_method" title="#update! (instance method)">#<strong>update!</strong> &#x21d2; Object </a>
314
+
315
+
316
+
317
+ </span>
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+ <span class="summary_desc"><div class='inline'></div></span>
328
+
329
+ </li>
330
+
331
+
332
+ </ul>
333
+
334
+
335
+ <div id="constructor_details" class="method_details_list">
336
+ <h2>Constructor Details</h2>
337
+
338
+ <div class="method_details first">
339
+ <h3 class="signature first" id="initialize-instance_method">
340
+
341
+ #<strong>initialize</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Swarm::Level (class)">Level</a></span></tt>
342
+
343
+
344
+
345
+
346
+
347
+ </h3><div class="docstring">
348
+ <div class="discussion">
349
+
350
+ <p>Returns a new instance of Level</p>
351
+
352
+
353
+ </div>
354
+ </div>
355
+ <div class="tags">
356
+
357
+
358
+ </div><table class="source_code">
359
+ <tr>
360
+ <td>
361
+ <pre class="lines">
362
+
363
+
364
+ 51
365
+ 52
366
+ 53
367
+ 54
368
+ 55
369
+ 56</pre>
370
+ </td>
371
+ <td>
372
+ <pre class="code"><span class="info file"># File 'lib/swarm/level.rb', line 51</span>
373
+
374
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
375
+ <span class='ivar'>@map</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Map.html" title="Swarm::Map (class)">Map</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Map.html#initialize-instance_method" title="Swarm::Map#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Console.html" title="Swarm::Console (module)">Console</a></span></span><span class='period'>.</span><span class='id identifier rubyid_width'><span class='object_link'><a href="Console.html#width-instance_method" title="Swarm::Console#width (method)">width</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Console.html" title="Swarm::Console (module)">Console</a></span></span><span class='period'>.</span><span class='id identifier rubyid_height'><span class='object_link'><a href="Console.html#height-instance_method" title="Swarm::Console#height (method)">height</a></span></span><span class='comma'>,</span> <span class='label'>tile_width:</span> <span class='int'>2</span><span class='rparen'>)</span>
376
+
377
+ <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='op'>&amp;</span><span class='symbol'>:empty!</span>
378
+ <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_update'>update</span>
379
+ <span class='kw'>end</span></pre>
380
+ </td>
381
+ </tr>
382
+ </table>
383
+ </div>
384
+
385
+ </div>
386
+
387
+
388
+ <div id="class_method_details" class="method_details_list">
389
+ <h2>Class Method Details</h2>
390
+
391
+
392
+ <div class="method_details first">
393
+ <h3 class="signature first" id="each-class_method">
394
+
395
+ .<strong>each</strong>(&amp;block) &#x21d2; <tt>Object</tt>
396
+
397
+
398
+
399
+
400
+
401
+ </h3><table class="source_code">
402
+ <tr>
403
+ <td>
404
+ <pre class="lines">
405
+
406
+
407
+ 5
408
+ 6
409
+ 7</pre>
410
+ </td>
411
+ <td>
412
+ <pre class="code"><span class="info file"># File 'lib/swarm/level.rb', line 5</span>
413
+
414
+ <span class='kw'>def</span> <span class='const'><span class='object_link'><a href="" title="Swarm::Level (class)">Level</a></span></span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
415
+ <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="Intro.html" title="Swarm::Intro (class)">Intro</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="One.html" title="Swarm::One (class)">One</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Two.html" title="Swarm::Two (class)">Two</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Three.html" title="Swarm::Three (class)">Three</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Four.html" title="Swarm::Four (class)">Four</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Five.html" title="Swarm::Five (class)">Five</a></span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_level'>level</span><span class='op'>|</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span> <span class='id identifier rubyid_level'>level</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='rbrace'>}</span>
416
+ <span class='kw'>end</span></pre>
417
+ </td>
418
+ </tr>
419
+ </table>
420
+ </div>
421
+
422
+ </div>
423
+
424
+ <div id="instance_method_details" class="method_details_list">
425
+ <h2>Instance Method Details</h2>
426
+
427
+
428
+ <div class="method_details first">
429
+ <h3 class="signature first" id="find_player-instance_method">
430
+
431
+ #<strong>find_player</strong> &#x21d2; <tt>Object</tt>
432
+
433
+
434
+
435
+
436
+
437
+ </h3><table class="source_code">
438
+ <tr>
439
+ <td>
440
+ <pre class="lines">
441
+
442
+
443
+ 18
444
+ 19
445
+ 20</pre>
446
+ </td>
447
+ <td>
448
+ <pre class="code"><span class="info file"># File 'lib/swarm/level.rb', line 18</span>
449
+
450
+ <span class='kw'>def</span> <span class='id identifier rubyid_find_player'>find_player</span>
451
+ <span class='ivar'>@player</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@player</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@player</span><span class='period'>.</span><span class='id identifier rubyid_player?'>player?</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='ivar'>@player</span> <span class='op'>:</span> <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:player?</span><span class='rparen'>)</span>
452
+ <span class='kw'>end</span></pre>
453
+ </td>
454
+ </tr>
455
+ </table>
456
+ </div>
457
+
458
+ <div class="method_details ">
459
+ <h3 class="signature " id="move-instance_method">
460
+
461
+ #<strong>move</strong>(tile, direction) &#x21d2; <tt>Object</tt>
462
+
463
+
464
+
465
+
466
+
467
+ </h3><table class="source_code">
468
+ <tr>
469
+ <td>
470
+ <pre class="lines">
471
+
472
+
473
+ 30
474
+ 31
475
+ 32
476
+ 33
477
+ 34
478
+ 35
479
+ 36
480
+ 37
481
+ 38
482
+ 39
483
+ 40
484
+ 41
485
+ 42
486
+ 43
487
+ 44
488
+ 45</pre>
489
+ </td>
490
+ <td>
491
+ <pre class="code"><span class="info file"># File 'lib/swarm/level.rb', line 30</span>
492
+
493
+ <span class='kw'>def</span> <span class='id identifier rubyid_move'>move</span><span class='lparen'>(</span><span class='id identifier rubyid_tile'>tile</span><span class='comma'>,</span> <span class='id identifier rubyid_direction'>direction</span><span class='rparen'>)</span>
494
+ <span class='kw'>case</span> <span class='id identifier rubyid_direction'>direction</span>
495
+ <span class='kw'>when</span> <span class='symbol'>:north</span><span class='comma'>,</span> <span class='symbol'>:south</span><span class='comma'>,</span> <span class='symbol'>:west</span><span class='comma'>,</span> <span class='symbol'>:east</span>
496
+ <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_move'>move</span><span class='lparen'>(</span><span class='id identifier rubyid_tile'>tile</span><span class='comma'>,</span> <span class='id identifier rubyid_direction'>direction</span><span class='rparen'>)</span>
497
+ <span class='kw'>else</span>
498
+ <span class='id identifier rubyid_available'>available</span> <span class='op'>=</span> <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_available_moves'>available_moves</span><span class='lparen'>(</span><span class='id identifier rubyid_tile'>tile</span><span class='rparen'>)</span>
499
+ <span class='id identifier rubyid_aggressive'>aggressive</span> <span class='op'>=</span> <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_aggressive_moves'>aggressive_moves</span><span class='lparen'>(</span><span class='id identifier rubyid_tile'>tile</span><span class='comma'>,</span> <span class='id identifier rubyid_direction'>direction</span><span class='rparen'>)</span>
500
+ <span class='id identifier rubyid_aggressive'>aggressive</span> <span class='op'>&amp;=</span> <span class='id identifier rubyid_available'>available</span>
501
+
502
+ <span class='kw'>if</span> <span class='id identifier rubyid_aggressive'>aggressive</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
503
+ <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_move'>move</span> <span class='id identifier rubyid_tile'>tile</span><span class='comma'>,</span> <span class='id identifier rubyid_aggressive'>aggressive</span><span class='period'>.</span><span class='id identifier rubyid_sample'>sample</span>
504
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_available'>available</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
505
+ <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_move'>move</span> <span class='id identifier rubyid_tile'>tile</span><span class='comma'>,</span> <span class='id identifier rubyid_available'>available</span><span class='period'>.</span><span class='id identifier rubyid_sample'>sample</span>
506
+ <span class='kw'>end</span>
507
+ <span class='kw'>end</span>
508
+ <span class='kw'>end</span></pre>
509
+ </td>
510
+ </tr>
511
+ </table>
512
+ </div>
513
+
514
+ <div class="method_details ">
515
+ <h3 class="signature " id="move_player-instance_method">
516
+
517
+ #<strong>move_player</strong>(direction) &#x21d2; <tt>Object</tt>
518
+
519
+
520
+
521
+
522
+
523
+ </h3><table class="source_code">
524
+ <tr>
525
+ <td>
526
+ <pre class="lines">
527
+
528
+
529
+ 26
530
+ 27
531
+ 28</pre>
532
+ </td>
533
+ <td>
534
+ <pre class="code"><span class="info file"># File 'lib/swarm/level.rb', line 26</span>
535
+
536
+ <span class='kw'>def</span> <span class='id identifier rubyid_move_player'>move_player</span><span class='lparen'>(</span><span class='id identifier rubyid_direction'>direction</span><span class='rparen'>)</span>
537
+ <span class='id identifier rubyid_move'>move</span> <span class='id identifier rubyid_find_player'>find_player</span><span class='comma'>,</span> <span class='id identifier rubyid_direction'>direction</span>
538
+ <span class='kw'>end</span></pre>
539
+ </td>
540
+ </tr>
541
+ </table>
542
+ </div>
543
+
544
+ <div class="method_details ">
545
+ <h3 class="signature " id="over?-instance_method">
546
+
547
+ #<strong>over?</strong> &#x21d2; <tt>Boolean</tt>
548
+
549
+
550
+
551
+
552
+
553
+ </h3><div class="docstring">
554
+ <div class="discussion">
555
+
556
+
557
+ </div>
558
+ </div>
559
+ <div class="tags">
560
+
561
+ <p class="tag_title">Returns:</p>
562
+ <ul class="return">
563
+
564
+ <li>
565
+
566
+
567
+ <span class='type'>(<tt>Boolean</tt>)</span>
568
+
569
+
570
+
571
+ </li>
572
+
573
+ </ul>
574
+
575
+ </div><table class="source_code">
576
+ <tr>
577
+ <td>
578
+ <pre class="lines">
579
+
580
+
581
+ 47
582
+ 48
583
+ 49</pre>
584
+ </td>
585
+ <td>
586
+ <pre class="code"><span class="info file"># File 'lib/swarm/level.rb', line 47</span>
587
+
588
+ <span class='kw'>def</span> <span class='id identifier rubyid_over?'>over?</span>
589
+ <span class='op'>!</span><span class='const'><span class='object_link'><a href="Catalog.html" title="Swarm::Catalog (class)">Catalog</a></span></span><span class='period'>.</span><span class='id identifier rubyid_select'><span class='object_link'><a href="Catalog.html#select-class_method" title="Swarm::Catalog.select (method)">select</a></span></span><span class='lparen'>(</span><span class='op'>*</span><span class='qsymbols_beg'>%i[</span><span class='tstring_content'>worker</span><span class='words_sep'> </span><span class='tstring_content'>soldier</span><span class='words_sep'> </span><span class='tstring_content'>queen</span><span class='words_sep'> </span><span class='tstring_content'>egg</span><span class='words_sep'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
590
+ <span class='kw'>end</span></pre>
591
+ </td>
592
+ </tr>
593
+ </table>
594
+ </div>
595
+
596
+ <div class="method_details ">
597
+ <h3 class="signature " id="spawn_player-instance_method">
598
+
599
+ #<strong>spawn_player</strong> &#x21d2; <tt>Object</tt>
600
+
601
+
602
+
603
+
604
+
605
+ </h3><table class="source_code">
606
+ <tr>
607
+ <td>
608
+ <pre class="lines">
609
+
610
+
611
+ 22
612
+ 23
613
+ 24</pre>
614
+ </td>
615
+ <td>
616
+ <pre class="code"><span class="info file"># File 'lib/swarm/level.rb', line 22</span>
617
+
618
+ <span class='kw'>def</span> <span class='id identifier rubyid_spawn_player'>spawn_player</span>
619
+ <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_center'>center</span><span class='period'>.</span><span class='id identifier rubyid_player!'>player!</span>
620
+ <span class='kw'>end</span></pre>
621
+ </td>
622
+ </tr>
623
+ </table>
624
+ </div>
625
+
626
+ <div class="method_details ">
627
+ <h3 class="signature " id="update-instance_method">
628
+
629
+ #<strong>update</strong> &#x21d2; <tt>Object</tt>
630
+
631
+
632
+
633
+
634
+
635
+ </h3><table class="source_code">
636
+ <tr>
637
+ <td>
638
+ <pre class="lines">
639
+
640
+
641
+ 9
642
+ 10
643
+ 11</pre>
644
+ </td>
645
+ <td>
646
+ <pre class="code"><span class="info file"># File 'lib/swarm/level.rb', line 9</span>
647
+
648
+ <span class='kw'>def</span> <span class='id identifier rubyid_update'>update</span>
649
+ <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_update'>update</span>
650
+ <span class='kw'>end</span></pre>
651
+ </td>
652
+ </tr>
653
+ </table>
654
+ </div>
655
+
656
+ <div class="method_details ">
657
+ <h3 class="signature " id="update!-instance_method">
658
+
659
+ #<strong>update!</strong> &#x21d2; <tt>Object</tt>
660
+
661
+
662
+
663
+
664
+
665
+ </h3><table class="source_code">
666
+ <tr>
667
+ <td>
668
+ <pre class="lines">
669
+
670
+
671
+ 13
672
+ 14
673
+ 15
674
+ 16</pre>
675
+ </td>
676
+ <td>
677
+ <pre class="code"><span class="info file"># File 'lib/swarm/level.rb', line 13</span>
678
+
679
+ <span class='kw'>def</span> <span class='id identifier rubyid_update!'>update!</span>
680
+ <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:change!</span><span class='rparen'>)</span>
681
+ <span class='ivar'>@map</span><span class='period'>.</span><span class='id identifier rubyid_update'>update</span>
682
+ <span class='kw'>end</span></pre>
683
+ </td>
684
+ </tr>
685
+ </table>
686
+ </div>
687
+
688
+ </div>
689
+
690
+ </div>
691
+
692
+ <div id="footer">
693
+ Generated on Wed Aug 30 07:17:59 2017 by
694
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
695
+ 0.9.9 (ruby-2.4.1).
696
+ </div>
697
+
698
+ </div>
699
+ </body>
700
+ </html>