battle_boats 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 0f62377f075c9e70f367ab75639126cf5b4c786c
4
- data.tar.gz: 2c179de8a9b6c69d0622c0a97806c1fb4277da01
3
+ metadata.gz: bd682e0861405e9ba63712042de47b7535a90818
4
+ data.tar.gz: 0e7466e52726d61e276e96070b8e79784177713c
5
5
  SHA512:
6
- metadata.gz: 7f8a5bab8721b38fe6f534f9512874464cb9b155a03d4a7ca5e2d0cdb04e64f3e6adab7c7e481ee4cf4585f45c1b902c304cbc3542947116963688e458c7fc8c
7
- data.tar.gz: 5f7bb5eca963fa72efbf9bebfc8ae663140f3003b260b411a757b98cadefc9142d98a60692c988210d96132c7ea2af29205baf815b82861a0260eb73f0e9e638
6
+ metadata.gz: 9760256d3da92abed54880362f771dabcf02dac95b5c43f0e99544ee5dce26458c6dda6c320a5a24e19c9d153adcea5d7d39bb4e96a9174b0806d27188eeb243
7
+ data.tar.gz: 3f098298b553b2db0e6c950a5743c96e5a36110108a37bb2cf75d143bca1d836eb7b52dc7ca1aefc94fde18414b25fe9223a3aad77ce1217851b85929f91e307
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.2.1
2
+ ### Enhancements
3
+ - Various enhancements and bug fixes
4
+
1
5
  # 0.2.0
2
6
  ### New Features
3
7
  - After placing your ships, you'll see two boards, yours and the computer player's
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- battle_boats (0.2.0)
4
+ battle_boats (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -3,11 +3,12 @@ require "battle_boats/fleet"
3
3
 
4
4
  module BattleBoats
5
5
  class Board
6
- attr_reader :fleet, :play_area, :status_report
6
+ attr_reader :fleet, :board_size, :play_area, :status_report
7
7
 
8
8
  def initialize(fleet: BattleBoats::Fleet.new)
9
9
  @fleet = fleet
10
10
  @status_report = ""
11
+ @board_size = 10
11
12
  @play_area = create_play_area
12
13
  end
13
14
 
@@ -67,15 +68,15 @@ module BattleBoats
67
68
  end
68
69
 
69
70
  def get_random_coordinate
70
- BattleBoats::Coordinate.random(row: 0..9, column: 0..9)
71
+ BattleBoats::Coordinate.random(row: 0...board_size, column: 0...board_size)
71
72
  end
72
73
 
73
74
  private
74
75
 
75
76
  def create_play_area
76
- Array.new(10) do
77
+ Array.new(board_size) do
77
78
  row = []
78
- 10.times do
79
+ board_size.times do
79
80
  row << BattleBoats::Cell.new
80
81
  end
81
82
  row
@@ -87,7 +88,8 @@ module BattleBoats
87
88
  end
88
89
 
89
90
  def within_range?(coordinate:)
90
- coordinate.row.between?(0, 9) && coordinate.column.between?(0, 9)
91
+ (0...board_size).cover?(coordinate.row) &&
92
+ (0...board_size).cover?(coordinate.column)
91
93
  end
92
94
  end
93
95
  end
@@ -1,3 +1,3 @@
1
1
  module BattleBoats
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.2.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: battle_boats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Countz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-07 00:00:00.000000000 Z
11
+ date: 2018-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler