battlesnake 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -0
- data/Gemfile.lock +1 -1
- data/docs/Battlesnake/Base.html +251 -0
- data/docs/Battlesnake/Board.html +648 -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 +119 -7
- data/docs/top-level-namespace.html +1 -1
- data/lib/battlesnake/base.rb +15 -0
- data/lib/battlesnake/board.rb +176 -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: b89d9fd8df0aef295a5b8b854347b633550daf06ec2327c9f0fbd7b220eaace4
|
4
|
+
data.tar.gz: 9eb544e850f0f4267519e9b802db9dce508f7a8eeb9d6d9cbc19463a0596f2e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
@@ -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 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>
|