battlesnake 0.1.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9063a25174a53025eafe1531362e7936d76642ee9bf277ffcf3fd991ee42748f
4
- data.tar.gz: bb1f156bf82db23929080a0a1522115f2b8f919856aa927b15e759c07b3fcd0d
3
+ metadata.gz: b89d9fd8df0aef295a5b8b854347b633550daf06ec2327c9f0fbd7b220eaace4
4
+ data.tar.gz: 9eb544e850f0f4267519e9b802db9dce508f7a8eeb9d6d9cbc19463a0596f2e1
5
5
  SHA512:
6
- metadata.gz: 47f22b9584800f6f45ad171691d3bb479ce091f1bc6c4baef6a7fe12b64b63f61d0de68e95d1b096207cd177fbff5a8b7332a961c74919c99894d98b1427570c
7
- data.tar.gz: f5eef7cc0ffb4bffb971c0932e7fcc96ff0ba19c3e5222575c60d97f2f9ab7c042367d97b5fa45aa05e22241a0fe1f45cfe3853c9edd89c2c127fd0e4afac392
6
+ metadata.gz: 48edb7affb7b6ff01e943b5cd4c9c87c8b6284b281f256bddda9412c1b371ab8ccdeb504fd5de469e830f789ea54fe66ae36c768e079f0f0757161bd88cac855
7
+ data.tar.gz: 86dbedc0c782be217c6220de2de438606fb8b006d6f0661b5da08c9f68dc967eaf116bc1901ae8451c55c3bb303d20287ab220762115cff4d62f8dfb90948e87
data/CHANGELOG.md CHANGED
@@ -0,0 +1,48 @@
1
+ # Battlesnake
2
+
3
+ ## 0.1.3 (2022-11-07)
4
+
5
+ ### Added
6
+
7
+ - Board
8
+ - #on_board?(location) returns true if location is within board boundaries.
9
+ - #paths(from, to) returns all valid paths from one location to the next.
10
+
11
+ ### Changed
12
+
13
+ - Board
14
+ - #occupied?(location) now only accepts a location object.
15
+ - #available?(location) now only accepts a location object.
16
+ - locations must be both unoccupied AND on_board to be considered available.
17
+
18
+ ## 0.1.2 (2022-11-05)
19
+
20
+ ### Added
21
+
22
+ - Class for Game, which deserializes game JSON or hash into object.
23
+ - Board:
24
+ - #occupied_locations returns array of all occupied locations; snakes, food, hazards, etc.
25
+ - #occupied?(location) returns true if location is occupied.
26
+ - #available?(location) returns true if location is available (unoccupied).
27
+ - #available_directions(location) returns directions (up, down, left, right) available for
28
+ moving.
29
+ - Model classes (Game, Board, Location, Snake):
30
+ - now inherit from a Base class.
31
+ - measure equality based on as_json method.
32
+
33
+ ## 0.1.1 (2022-11-04)
34
+
35
+ ### Added
36
+
37
+ - Class for Board, which deserializes board JSON or hash into object with Snake and Location
38
+ objects.
39
+
40
+ ## 0.1.0 (2022-11-04)
41
+
42
+ ### Initial Release
43
+
44
+ - Class for Location, which deserializes coordinate JSON, hash with (x,y) keys, array of two
45
+ elements, or two parameters into object with helper methods.
46
+ - Class for Snake, which deserializes snake JSON or hash into object with Location objects and
47
+ helper methods.
48
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- battlesnake (0.1.1)
4
+ battlesnake (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,251 @@
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::Base
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::Base";
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 (B)</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">Base</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::Base
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">Battlesnake::Base</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/battlesnake/base.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Base class for “model” classes - _Game, Board, Snake, Location,_ etc.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div><div id="subclasses">
114
+ <h2>Direct Known Subclasses</h2>
115
+ <p class="children"><span class='object_link'><a href="Board.html" title="Battlesnake::Board (class)">Board</a></span>, <span class='object_link'><a href="Game.html" title="Battlesnake::Game (class)">Game</a></span>, <span class='object_link'><a href="Location.html" title="Battlesnake::Location (class)">Location</a></span>, <span class='object_link'><a href="Snake.html" title="Battlesnake::Snake (class)">Snake</a></span></p>
116
+ </div>
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+ <h2>
126
+ Instance Method Summary
127
+ <small><a href="#" class="summary_toggle">collapse</a></small>
128
+ </h2>
129
+
130
+ <ul class="summary">
131
+
132
+ <li class="public ">
133
+ <span class="summary_signature">
134
+
135
+ <a href="#==-instance_method" title="#== (instance method)">#<strong>==</strong>(other) &#x21d2; Boolean </a>
136
+
137
+
138
+
139
+ </span>
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ <span class="summary_desc"><div class='inline'>
150
+ <p>Whether both locations have the same coordinates.</p>
151
+ </div></span>
152
+
153
+ </li>
154
+
155
+
156
+ </ul>
157
+
158
+
159
+
160
+
161
+ <div id="instance_method_details" class="method_details_list">
162
+ <h2>Instance Method Details</h2>
163
+
164
+
165
+ <div class="method_details first">
166
+ <h3 class="signature first" id="==-instance_method">
167
+
168
+ #<strong>==</strong>(other) &#x21d2; <tt>Boolean</tt>
169
+
170
+
171
+
172
+
173
+
174
+ </h3><div class="docstring">
175
+ <div class="discussion">
176
+
177
+ <p>Whether both locations have the same coordinates.</p>
178
+
179
+
180
+ </div>
181
+ </div>
182
+ <div class="tags">
183
+ <p class="tag_title">Parameters:</p>
184
+ <ul class="param">
185
+
186
+ <li>
187
+
188
+ <span class='name'>other</span>
189
+
190
+
191
+ <span class='type'>(<tt><span class='object_link'><a href="Location.html" title="Battlesnake::Location (class)">Location</a></span></tt>)</span>
192
+
193
+
194
+
195
+ </li>
196
+
197
+ </ul>
198
+
199
+ <p class="tag_title">Returns:</p>
200
+ <ul class="return">
201
+
202
+ <li>
203
+
204
+
205
+ <span class='type'>(<tt>Boolean</tt>)</span>
206
+
207
+
208
+
209
+ &mdash;
210
+ <div class='inline'>
211
+ <p>true if location objects have the same coordinates.</p>
212
+ </div>
213
+
214
+ </li>
215
+
216
+ </ul>
217
+
218
+ </div><table class="source_code">
219
+ <tr>
220
+ <td>
221
+ <pre class="lines">
222
+
223
+
224
+ 11
225
+ 12
226
+ 13</pre>
227
+ </td>
228
+ <td>
229
+ <pre class="code"><span class="info file"># File 'lib/battlesnake/base.rb', line 11</span>
230
+
231
+ <span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
232
+ <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_as_json'>as_json</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_as_json'>as_json</span>
233
+ <span class='kw'>end</span></pre>
234
+ </td>
235
+ </tr>
236
+ </table>
237
+ </div>
238
+
239
+ </div>
240
+
241
+ </div>
242
+
243
+ <div id="footer">
244
+ Generated on Mon Nov 7 15:30:13 2022 by
245
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
246
+ 0.9.28 (ruby-2.7.2).
247
+ </div>
248
+
249
+ </div>
250
+ </body>
251
+ </html>