battle_boats 0.0.20 → 0.1.0

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: c234594bcdb65723e19dd4386b5fc3fff1a12e11
4
- data.tar.gz: 831459a8cbe3467c52984597f7242bb9048ea008
3
+ metadata.gz: 61b60dbcbc5c2bacf5a9690767c0e8cb0fb63b93
4
+ data.tar.gz: 2fd42e2e42aee3d500a4d80025183e5f545c82b8
5
5
  SHA512:
6
- metadata.gz: 0a809442d9468226c1bbe15ce3463a2c4c59336a2105c2c00dc70851c952cfda7fe36acd897fcf859b76d6d65349b21a0dc08f5cfca917f06728a7b1fb114493
7
- data.tar.gz: ef473db7cb3250ea218cc03c4f33cd25655816d8c47d4595d96dd3a36c9f0575e44ef241506ba91ac3a976cf6c5df6a4a24e5360f9c35fad046b166f5ea3b92d
6
+ metadata.gz: 97c3219a5f1dfa994cc2aabb0a4c716f5b044296a7a5f3efb862c5ecc5f889c68becb3a746ffece89770227137b9728c91e27c944636ad59549894cd371070a0
7
+ data.tar.gz: 5b165df1380372d778d6c5708a063de0269912f6c28bc85efe6444d1db770ecf990b0fc8892e30106ba6985c75c27ed88ec77e47c3d12948563c90bda119c2f1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.1.0
2
+ ### New Features
3
+ - At the start of the game, the user will be prompted to place their ships on their board
4
+ - After all ships are place, the game will continue as it previously had
5
+
1
6
  # 0.0.20
2
7
  ### Breaking Change
3
8
  - `battle_boats "dev"` is not longer available
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- battle_boats (0.0.20)
4
+ battle_boats (0.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/bin/battle_boats CHANGED
@@ -3,9 +3,10 @@
3
3
  require 'battle_boats/engine'
4
4
  require 'battle_boats/board'
5
5
 
6
- board = BattleBoats::Board.new
7
- board.place_ships_randomly
6
+ enemy_board = BattleBoats::Board.new
7
+ enemy_board.place_ships_randomly
8
8
 
9
- engine = BattleBoats::Engine.new(board: board)
9
+ engine = BattleBoats::Engine.new(enemy_board: enemy_board)
10
+ engine.place_ships_manually
10
11
  engine.start
11
12
 
@@ -4,28 +4,44 @@ require_relative "console_ui"
4
4
  module BattleBoats
5
5
  class Engine
6
6
  def initialize(interface: BattleBoats::ConsoleUI.new,
7
- board: BattleBoats::Board.new)
7
+ enemy_board: BattleBoats::Board.new,
8
+ ally_board: BattleBoats::Board.new)
8
9
  @interface = interface
9
- @board = board
10
+ @enemy_board = enemy_board
11
+ @ally_board = ally_board
12
+ end
13
+
14
+ def place_ships_manually
15
+ ally_board.fleet.ships.each do |ship|
16
+ until ally_board.ship_deployed?(ship: ship)
17
+ interface.display_ally_board(ally_board)
18
+ interface.display_ship_data(ship: ship)
19
+ coordinate = interface.get_coordinate
20
+ orientation = interface.get_orientation
21
+ ally_board.attempt_to_deploy_ship(ship: ship,
22
+ coordinate: coordinate,
23
+ orientation: orientation)
24
+ end
25
+ end
10
26
  end
11
27
 
12
28
  def start
13
29
  interface.greet
14
- until board.game_over?
15
- interface.display_board(board)
30
+ until enemy_board.game_over?
31
+ interface.display_board(enemy_board)
16
32
  coordinate = interface.get_coordinate
17
- until board.strike_position(coordinate: coordinate)
18
- interface.display_status_report(board.status_report)
33
+ until enemy_board.strike_position(coordinate: coordinate)
34
+ interface.display_status_report(enemy_board.status_report)
19
35
  coordinate = interface.get_coordinate
20
36
  end
21
- interface.display_status_report(board.status_report)
37
+ interface.display_status_report(enemy_board.status_report)
22
38
  end
23
39
  interface.win
24
- interface.display_board(board)
40
+ interface.display_board(enemy_board)
25
41
  end
26
42
 
27
43
  private
28
44
 
29
- attr_reader :interface, :board
45
+ attr_reader :interface, :enemy_board, :ally_board
30
46
  end
31
47
  end
@@ -1,3 +1,3 @@
1
1
  module BattleBoats
2
- VERSION = "0.0.20".freeze
2
+ VERSION = "0.1.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: battle_boats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Countz