battlesnake 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,813 @@
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: Battlesnake::Game
8
+
9
+ &mdash; Documentation by YARD 0.9.28
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Battlesnake::Game";
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 (G)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Battlesnake.html" title="Battlesnake (module)">Battlesnake</a></span></span>
41
+ &raquo;
42
+ <span class="title">Game</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: Battlesnake::Game
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="Base.html" title="Battlesnake::Base (class)">Base</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="Base.html" title="Battlesnake::Base (class)">Base</a></span></li>
78
+
79
+ <li class="next">Battlesnake::Game</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/battlesnake/game.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+
107
+ <p>Represents a Battlesnake game.</p>
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+
115
+ </div>
116
+
117
+
118
+
119
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
120
+ <ul class="summary">
121
+
122
+ <li class="public ">
123
+ <span class="summary_signature">
124
+
125
+ <a href="#as_json-instance_method" title="#as_json (instance method)">#<strong>as_json</strong> &#x21d2; Hash </a>
126
+
127
+
128
+
129
+ </span>
130
+
131
+
132
+
133
+
134
+ <span class="note title readonly">readonly</span>
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+ <span class="summary_desc"><div class='inline'>
145
+ <p>Snake as a data structure usable by other objects.</p>
146
+ </div></span>
147
+
148
+ </li>
149
+
150
+
151
+ <li class="public ">
152
+ <span class="summary_signature">
153
+
154
+ <a href="#id-instance_method" title="#id (instance method)">#<strong>id</strong> &#x21d2; String </a>
155
+
156
+
157
+
158
+ </span>
159
+
160
+
161
+
162
+
163
+ <span class="note title readonly">readonly</span>
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+ <span class="summary_desc"><div class='inline'>
174
+ <p>Unique identifier for this game.</p>
175
+ </div></span>
176
+
177
+ </li>
178
+
179
+
180
+ <li class="public ">
181
+ <span class="summary_signature">
182
+
183
+ <a href="#map-instance_method" title="#map (instance method)">#<strong>map</strong> &#x21d2; String </a>
184
+
185
+
186
+
187
+ </span>
188
+
189
+
190
+
191
+
192
+ <span class="note title readonly">readonly</span>
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <span class="summary_desc"><div class='inline'>
203
+ <p>Name of the map used to populate the game board with snakes, food, and hazards.</p>
204
+ </div></span>
205
+
206
+ </li>
207
+
208
+
209
+ <li class="public ">
210
+ <span class="summary_signature">
211
+
212
+ <a href="#ruleset-instance_method" title="#ruleset (instance method)">#<strong>ruleset</strong> &#x21d2; Hash </a>
213
+
214
+
215
+
216
+ </span>
217
+
218
+
219
+
220
+
221
+ <span class="note title readonly">readonly</span>
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+ <span class="summary_desc"><div class='inline'>
232
+ <p>Information about the ruleset being used to run this game.</p>
233
+ </div></span>
234
+
235
+ </li>
236
+
237
+
238
+ <li class="public ">
239
+ <span class="summary_signature">
240
+
241
+ <a href="#source-instance_method" title="#source (instance method)">#<strong>source</strong> &#x21d2; String </a>
242
+
243
+
244
+
245
+ </span>
246
+
247
+
248
+
249
+
250
+ <span class="note title readonly">readonly</span>
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+ <span class="summary_desc"><div class='inline'>
261
+ <p>Source of this game.</p>
262
+ </div></span>
263
+
264
+ </li>
265
+
266
+
267
+ <li class="public ">
268
+ <span class="summary_signature">
269
+
270
+ <a href="#timeout-instance_method" title="#timeout (instance method)">#<strong>timeout</strong> &#x21d2; Integer </a>
271
+
272
+
273
+
274
+ </span>
275
+
276
+
277
+
278
+
279
+ <span class="note title readonly">readonly</span>
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+ <span class="summary_desc"><div class='inline'>
290
+ <p>How much time player APIs have to respond to requests for this game.</p>
291
+ </div></span>
292
+
293
+ </li>
294
+
295
+
296
+ </ul>
297
+
298
+
299
+
300
+
301
+
302
+ <h2>
303
+ Instance Method Summary
304
+ <small><a href="#" class="summary_toggle">collapse</a></small>
305
+ </h2>
306
+
307
+ <ul class="summary">
308
+
309
+ <li class="public ">
310
+ <span class="summary_signature">
311
+
312
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(json_or_hash) &#x21d2; Game </a>
313
+
314
+
315
+
316
+ </span>
317
+
318
+
319
+ <span class="note title constructor">constructor</span>
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+ <span class="summary_desc"><div class='inline'>
329
+ <p>Returns a new instance of Game.</p>
330
+ </div></span>
331
+
332
+ </li>
333
+
334
+
335
+ </ul>
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Base.html" title="Battlesnake::Base (class)">Base</a></span></h3>
348
+ <p class="inherited"><span class='object_link'><a href="Base.html#==-instance_method" title="Battlesnake::Base#== (method)">#==</a></span></p>
349
+ <div id="constructor_details" class="method_details_list">
350
+ <h2>Constructor Details</h2>
351
+
352
+ <div class="method_details first">
353
+ <h3 class="signature first" id="initialize-instance_method">
354
+
355
+ #<strong>initialize</strong>(json_or_hash) &#x21d2; <tt><span class='object_link'><a href="" title="Battlesnake::Game (class)">Game</a></span></tt>
356
+
357
+
358
+
359
+
360
+
361
+ </h3><div class="docstring">
362
+ <div class="discussion">
363
+
364
+ <p>Returns a new instance of Game.</p>
365
+
366
+
367
+ </div>
368
+ </div>
369
+ <div class="tags">
370
+ <p class="tag_title">Parameters:</p>
371
+ <ul class="param">
372
+
373
+ <li>
374
+
375
+ <span class='name'>json_or_hash</span>
376
+
377
+
378
+ <span class='type'>(<tt>String</tt>, <tt>Hash</tt>)</span>
379
+
380
+
381
+
382
+ &mdash;
383
+ <div class='inline'>
384
+ <p>can be a hash of attributes, or a JSON string which represents such a structure.</p>
385
+ </div>
386
+
387
+ </li>
388
+
389
+ </ul>
390
+
391
+
392
+ </div><table class="source_code">
393
+ <tr>
394
+ <td>
395
+ <pre class="lines">
396
+
397
+
398
+ 32
399
+ 33
400
+ 34
401
+ 35
402
+ 36
403
+ 37
404
+ 38
405
+ 39
406
+ 40
407
+ 41
408
+ 42</pre>
409
+ </td>
410
+ <td>
411
+ <pre class="code"><span class="info file"># File 'lib/battlesnake/game.rb', line 32</span>
412
+
413
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_json_or_hash'>json_or_hash</span><span class='rparen'>)</span>
414
+ <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_json_or_hash'>json_or_hash</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json_or_hash'>json_or_hash</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_json_or_hash'>json_or_hash</span>
415
+
416
+ <span class='ivar'>@as_json</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span>
417
+
418
+ <span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>id</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
419
+ <span class='ivar'>@ruleset</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>ruleset</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
420
+ <span class='ivar'>@map</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>map</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
421
+ <span class='ivar'>@timeout</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>timeout</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
422
+ <span class='ivar'>@source</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>source</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
423
+ <span class='kw'>end</span></pre>
424
+ </td>
425
+ </tr>
426
+ </table>
427
+ </div>
428
+
429
+ </div>
430
+
431
+ <div id="instance_attr_details" class="attr_details">
432
+ <h2>Instance Attribute Details</h2>
433
+
434
+
435
+ <span id=""></span>
436
+ <div class="method_details first">
437
+ <h3 class="signature first" id="as_json-instance_method">
438
+
439
+ #<strong>as_json</strong> &#x21d2; <tt>Hash</tt> <span class="extras">(readonly)</span>
440
+
441
+
442
+
443
+
444
+
445
+ </h3><div class="docstring">
446
+ <div class="discussion">
447
+
448
+ <p>Returns snake as a data structure usable by other objects.</p>
449
+
450
+
451
+ </div>
452
+ </div>
453
+ <div class="tags">
454
+
455
+ <p class="tag_title">Returns:</p>
456
+ <ul class="return">
457
+
458
+ <li>
459
+
460
+
461
+ <span class='type'>(<tt>Hash</tt>)</span>
462
+
463
+
464
+
465
+ &mdash;
466
+ <div class='inline'>
467
+ <p>snake as a data structure usable by other objects.</p>
468
+ </div>
469
+
470
+ </li>
471
+
472
+ </ul>
473
+
474
+ </div><table class="source_code">
475
+ <tr>
476
+ <td>
477
+ <pre class="lines">
478
+
479
+
480
+ 8
481
+ 9
482
+ 10</pre>
483
+ </td>
484
+ <td>
485
+ <pre class="code"><span class="info file"># File 'lib/battlesnake/game.rb', line 8</span>
486
+
487
+ <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span>
488
+ <span class='ivar'>@as_json</span>
489
+ <span class='kw'>end</span></pre>
490
+ </td>
491
+ </tr>
492
+ </table>
493
+ </div>
494
+
495
+
496
+ <span id=""></span>
497
+ <div class="method_details ">
498
+ <h3 class="signature " id="id-instance_method">
499
+
500
+ #<strong>id</strong> &#x21d2; <tt>String</tt> <span class="extras">(readonly)</span>
501
+
502
+
503
+
504
+
505
+
506
+ </h3><div class="docstring">
507
+ <div class="discussion">
508
+
509
+ <p>Returns unique identifier for this game.</p>
510
+
511
+
512
+ </div>
513
+ </div>
514
+ <div class="tags">
515
+
516
+ <p class="tag_title">Returns:</p>
517
+ <ul class="return">
518
+
519
+ <li>
520
+
521
+
522
+ <span class='type'>(<tt>String</tt>)</span>
523
+
524
+
525
+
526
+ &mdash;
527
+ <div class='inline'>
528
+ <p>unique identifier for this game.</p>
529
+ </div>
530
+
531
+ </li>
532
+
533
+ </ul>
534
+
535
+ </div><table class="source_code">
536
+ <tr>
537
+ <td>
538
+ <pre class="lines">
539
+
540
+
541
+ 11
542
+ 12
543
+ 13</pre>
544
+ </td>
545
+ <td>
546
+ <pre class="code"><span class="info file"># File 'lib/battlesnake/game.rb', line 11</span>
547
+
548
+ <span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
549
+ <span class='ivar'>@id</span>
550
+ <span class='kw'>end</span></pre>
551
+ </td>
552
+ </tr>
553
+ </table>
554
+ </div>
555
+
556
+
557
+ <span id=""></span>
558
+ <div class="method_details ">
559
+ <h3 class="signature " id="map-instance_method">
560
+
561
+ #<strong>map</strong> &#x21d2; <tt>String</tt> <span class="extras">(readonly)</span>
562
+
563
+
564
+
565
+
566
+
567
+ </h3><div class="docstring">
568
+ <div class="discussion">
569
+
570
+ <p>Returns name of the map used to populate the game board with snakes, food, and hazards.</p>
571
+
572
+
573
+ </div>
574
+ </div>
575
+ <div class="tags">
576
+
577
+ <p class="tag_title">Returns:</p>
578
+ <ul class="return">
579
+
580
+ <li>
581
+
582
+
583
+ <span class='type'>(<tt>String</tt>)</span>
584
+
585
+
586
+
587
+ &mdash;
588
+ <div class='inline'>
589
+ <p>name of the map used to populate the game board with snakes, food, and hazards.</p>
590
+ </div>
591
+
592
+ </li>
593
+
594
+ </ul>
595
+
596
+ </div><table class="source_code">
597
+ <tr>
598
+ <td>
599
+ <pre class="lines">
600
+
601
+
602
+ 17
603
+ 18
604
+ 19</pre>
605
+ </td>
606
+ <td>
607
+ <pre class="code"><span class="info file"># File 'lib/battlesnake/game.rb', line 17</span>
608
+
609
+ <span class='kw'>def</span> <span class='id identifier rubyid_map'>map</span>
610
+ <span class='ivar'>@map</span>
611
+ <span class='kw'>end</span></pre>
612
+ </td>
613
+ </tr>
614
+ </table>
615
+ </div>
616
+
617
+
618
+ <span id=""></span>
619
+ <div class="method_details ">
620
+ <h3 class="signature " id="ruleset-instance_method">
621
+
622
+ #<strong>ruleset</strong> &#x21d2; <tt>Hash</tt> <span class="extras">(readonly)</span>
623
+
624
+
625
+
626
+
627
+
628
+ </h3><div class="docstring">
629
+ <div class="discussion">
630
+
631
+ <p>Returns information about the ruleset being used to run this game.</p>
632
+
633
+
634
+ </div>
635
+ </div>
636
+ <div class="tags">
637
+
638
+ <p class="tag_title">Returns:</p>
639
+ <ul class="return">
640
+
641
+ <li>
642
+
643
+
644
+ <span class='type'>(<tt>Hash</tt>)</span>
645
+
646
+
647
+
648
+ &mdash;
649
+ <div class='inline'>
650
+ <p>information about the ruleset being used to run this game.</p>
651
+ </div>
652
+
653
+ </li>
654
+
655
+ </ul>
656
+
657
+ </div><table class="source_code">
658
+ <tr>
659
+ <td>
660
+ <pre class="lines">
661
+
662
+
663
+ 14
664
+ 15
665
+ 16</pre>
666
+ </td>
667
+ <td>
668
+ <pre class="code"><span class="info file"># File 'lib/battlesnake/game.rb', line 14</span>
669
+
670
+ <span class='kw'>def</span> <span class='id identifier rubyid_ruleset'>ruleset</span>
671
+ <span class='ivar'>@ruleset</span>
672
+ <span class='kw'>end</span></pre>
673
+ </td>
674
+ </tr>
675
+ </table>
676
+ </div>
677
+
678
+
679
+ <span id=""></span>
680
+ <div class="method_details ">
681
+ <h3 class="signature " id="source-instance_method">
682
+
683
+ #<strong>source</strong> &#x21d2; <tt>String</tt> <span class="extras">(readonly)</span>
684
+
685
+
686
+
687
+
688
+
689
+ </h3><div class="docstring">
690
+ <div class="discussion">
691
+
692
+ <p>Returns source of this game.</p>
693
+
694
+
695
+ </div>
696
+ </div>
697
+ <div class="tags">
698
+
699
+ <p class="tag_title">Returns:</p>
700
+ <ul class="return">
701
+
702
+ <li>
703
+
704
+
705
+ <span class='type'>(<tt>String</tt>)</span>
706
+
707
+
708
+
709
+ &mdash;
710
+ <div class='inline'>
711
+ <p>source of this game.</p>
712
+ </div>
713
+
714
+ </li>
715
+
716
+ </ul>
717
+
718
+ </div><table class="source_code">
719
+ <tr>
720
+ <td>
721
+ <pre class="lines">
722
+
723
+
724
+ 23
725
+ 24
726
+ 25</pre>
727
+ </td>
728
+ <td>
729
+ <pre class="code"><span class="info file"># File 'lib/battlesnake/game.rb', line 23</span>
730
+
731
+ <span class='kw'>def</span> <span class='id identifier rubyid_source'>source</span>
732
+ <span class='ivar'>@source</span>
733
+ <span class='kw'>end</span></pre>
734
+ </td>
735
+ </tr>
736
+ </table>
737
+ </div>
738
+
739
+
740
+ <span id=""></span>
741
+ <div class="method_details ">
742
+ <h3 class="signature " id="timeout-instance_method">
743
+
744
+ #<strong>timeout</strong> &#x21d2; <tt>Integer</tt> <span class="extras">(readonly)</span>
745
+
746
+
747
+
748
+
749
+
750
+ </h3><div class="docstring">
751
+ <div class="discussion">
752
+
753
+ <p>Returns how much time player APIs have to respond to requests for this game.</p>
754
+
755
+
756
+ </div>
757
+ </div>
758
+ <div class="tags">
759
+
760
+ <p class="tag_title">Returns:</p>
761
+ <ul class="return">
762
+
763
+ <li>
764
+
765
+
766
+ <span class='type'>(<tt>Integer</tt>)</span>
767
+
768
+
769
+
770
+ &mdash;
771
+ <div class='inline'>
772
+ <p>how much time player APIs have to respond to requests for this game.</p>
773
+ </div>
774
+
775
+ </li>
776
+
777
+ </ul>
778
+
779
+ </div><table class="source_code">
780
+ <tr>
781
+ <td>
782
+ <pre class="lines">
783
+
784
+
785
+ 20
786
+ 21
787
+ 22</pre>
788
+ </td>
789
+ <td>
790
+ <pre class="code"><span class="info file"># File 'lib/battlesnake/game.rb', line 20</span>
791
+
792
+ <span class='kw'>def</span> <span class='id identifier rubyid_timeout'>timeout</span>
793
+ <span class='ivar'>@timeout</span>
794
+ <span class='kw'>end</span></pre>
795
+ </td>
796
+ </tr>
797
+ </table>
798
+ </div>
799
+
800
+ </div>
801
+
802
+
803
+ </div>
804
+
805
+ <div id="footer">
806
+ Generated on Mon Nov 7 15:30:13 2022 by
807
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
808
+ 0.9.28 (ruby-2.7.2).
809
+ </div>
810
+
811
+ </div>
812
+ </body>
813
+ </html>