battlesnake 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b89d9fd8df0aef295a5b8b854347b633550daf06ec2327c9f0fbd7b220eaace4
4
- data.tar.gz: 9eb544e850f0f4267519e9b802db9dce508f7a8eeb9d6d9cbc19463a0596f2e1
3
+ metadata.gz: dc1006d3ed555bc10587302b1d0bd9323e92f2a194bc2ce6673ac44e4b502f74
4
+ data.tar.gz: e5a12dcd3a84f68b6d70735448d115a007909018b27010597753c7dff41aba84
5
5
  SHA512:
6
- metadata.gz: 48edb7affb7b6ff01e943b5cd4c9c87c8b6284b281f256bddda9412c1b371ab8ccdeb504fd5de469e830f789ea54fe66ae36c768e079f0f0757161bd88cac855
7
- data.tar.gz: 86dbedc0c782be217c6220de2de438606fb8b006d6f0661b5da08c9f68dc967eaf116bc1901ae8451c55c3bb303d20287ab220762115cff4d62f8dfb90948e87
6
+ metadata.gz: 66184f4a9b2474337f1d25a76a4ffd7cd2b63beeb390a7a3261e2ff51911b7c2dcabd453f7510018b785869ab25736d3e31e35e031111cbd4c8ef39966f1182c
7
+ data.tar.gz: 9ebae26dac464f629359f325f871500d0634a5bdf381ec416b8581ff358777ae94267973c5c937921279afc5dc45490ad63bc8e4357f4f2dce61cde08f0537ca
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Battlesnake
2
2
 
3
+ ## 0.1.4 (2023-01-03)
4
+
5
+ ### Added
6
+
7
+ - Board
8
+ - #food?(location) returns true if location is food.
9
+
10
+ ### Changed
11
+
12
+ - Board
13
+ - #occupied_locations no longer includes food.
14
+
3
15
  ## 0.1.3 (2022-11-07)
4
16
 
5
17
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- battlesnake (0.1.3)
4
+ battlesnake (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -41,12 +41,13 @@ module Battlesnake
41
41
  end
42
42
 
43
43
  ##
44
- # List of all occupied locations on the board; snakes, food, hazards, etc
44
+ # List of all occupied locations on the board; snakes, hazards, etc.
45
+ # Does NOT include food, since we don't want to avoid that.
45
46
  #
46
47
  # @return [Array<Location>] list of occupied locations
47
48
  def occupied_locations
48
49
  return @occupied_locations if defined?(@occupied_locations)
49
- @occupied_locations = snakes.map(&:body).flatten + food + hazards
50
+ @occupied_locations = snakes.map(&:body).flatten + hazards
50
51
  end
51
52
 
52
53
  ##
@@ -79,6 +80,16 @@ module Battlesnake
79
80
  on_board?(location) && !occupied?(location)
80
81
  end
81
82
 
83
+ ##
84
+ # Whether the supplied location is food.
85
+ #
86
+ # @param [Location] location being tested for availability.
87
+ #
88
+ # @return [Boolean] true if location is food.
89
+ def food?(location)
90
+ food.include?(location)
91
+ end
92
+
82
93
  ##
83
94
  # List of directions (up, down, left, right) available for moving from given _Location_.
84
95
  #
@@ -1,4 +1,4 @@
1
1
  module Battlesnake
2
2
  # The current version of the driver.
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: battlesnake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Bellmyer