battlesnake 0.1.1 → 0.1.2
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 +4 -4
- data/CHANGELOG.md +33 -0
- data/Gemfile.lock +1 -1
- data/docs/Battlesnake/Base.html +251 -0
- data/docs/Battlesnake/Board.html +421 -2
- data/docs/Battlesnake/Error.html +1 -1
- data/docs/Battlesnake/Game.html +813 -0
- data/docs/Battlesnake/Location.html +15 -2
- data/docs/Battlesnake/Snake.html +15 -2
- data/docs/Battlesnake.html +4 -4
- data/docs/_index.html +23 -1
- data/docs/class_list.html +1 -1
- data/docs/file.README.html +1 -1
- data/docs/index.html +1 -1
- data/docs/method_list.html +101 -5
- data/docs/top-level-namespace.html +1 -1
- data/lib/battlesnake/base.rb +15 -0
- data/lib/battlesnake/board.rb +47 -1
- data/lib/battlesnake/game.rb +44 -0
- data/lib/battlesnake/location.rb +1 -1
- data/lib/battlesnake/snake.rb +1 -1
- data/lib/battlesnake/version.rb +1 -1
- data/lib/battlesnake.rb +2 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2100d8f190752e432572971a16b1ad7de7ee941008df10df475084d9851cb8e
|
4
|
+
data.tar.gz: 17435dbdad3f48cb3f99591af60b2f471dcafca058221146b534754a09b6be13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34023efce3a589e86f65a30f983b93f9c24d745faebbaf05ef4db31d0a695be641665f282f45fe6d84a0c35462c4b7d67a91ae67bee11af0842fa67cf71536f9
|
7
|
+
data.tar.gz: 8565f7f891d1c59be120f9b002e2f2c2242ef38b68dae5e0798da735a3353f83d8cd1ec232203e3515845b3380690f378a744851671ffa2b1c9de0af8cec63d8
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Battlesnake
|
2
|
+
|
3
|
+
## 0.1.2 (2022-11-05)
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Class for Game, which deserializes game JSON or hash into object.
|
8
|
+
- Board:
|
9
|
+
- #occupied_locations returns array of all occupied locations; snakes, food, hazards, etc.
|
10
|
+
- #occupied?(location) returns true if location is occupied.
|
11
|
+
- #available?(location) returns true if location is available (unoccupied).
|
12
|
+
- #available_directions(location) returns directions (up, down, left, right) available for
|
13
|
+
moving.
|
14
|
+
- Model classes (Game, Board, Location, Snake):
|
15
|
+
- now inherit from a Base class.
|
16
|
+
- measure equality based on as_json method.
|
17
|
+
|
18
|
+
## 0.1.1 (2022-11-04)
|
19
|
+
|
20
|
+
### Added
|
21
|
+
|
22
|
+
- Class for Board, which deserializes board JSON or hash into object with Snake and Location
|
23
|
+
objects.
|
24
|
+
|
25
|
+
## 0.1.0 (2022-11-04)
|
26
|
+
|
27
|
+
### Initial Release
|
28
|
+
|
29
|
+
- Class for Location, which deserializes coordinate JSON, hash with (x,y) keys, array of two
|
30
|
+
elements, or two parameters into object with helper methods.
|
31
|
+
- Class for Snake, which deserializes snake JSON or hash into object with Location objects and
|
32
|
+
helper methods.
|
33
|
+
|
data/Gemfile.lock
CHANGED
@@ -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
|
+
— 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> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Battlesnake.html" title="Battlesnake (module)">Battlesnake</a></span></span>
|
41
|
+
»
|
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) ⇒ 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) ⇒ <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
|
+
—
|
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'>&&</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 Sat Nov 5 20:09:02 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>
|