battle_boats 0.0.5 → 0.0.6

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: 0fc91ef81269dd27748b5d9d56ce2ca769e97eac
4
- data.tar.gz: 191033ffb7cda58c5f6e9ae5a630434f1f3ae511
3
+ metadata.gz: 765cef2a3566e7f824cd2319ec960c90f0d26622
4
+ data.tar.gz: 1de5b33a33bce1bac1162ad670ca0af38499d277
5
5
  SHA512:
6
- metadata.gz: 496aacce57286fbc9a644c889eb58a7ca49d67d3880194a10ec88014b81dd9126ecf09ee1c22e69b3d046b647b6050de9504f2ae59dc9e1698977413b7b6bd13
7
- data.tar.gz: a2eab93f0dd9c5b4e4212767d71e7b568fd97ced611c16446bbc655817c7fdb7cdd2731b35a019457eea73f21bf09651de8becfae3efc2dbc3bfa6177b68a327
6
+ metadata.gz: 8a5e7d65fc210a47de5df56a539fa4d53f0fed11d3f7f67b2aa0f2fca733e7b0f061166dbe1f7e42b002529e8f10ddcb1ccdcb075ac4f17ba1aa1d40593a6ca7
7
+ data.tar.gz: 68ebe43ee2985c47cd9275d71e138ebc085b7074ca76e43bf62edaa4cf8ee96e9885d3e53b14c90b06241abc075bc5f3f9630b732fa8e5b711b655355d7ffe19
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.6
2
+ ### New Features
3
+ - The game is now in color!
4
+
1
5
  # 0.0.5
2
6
  ### New Features
3
7
  - Starting the game will display a board of randomly placed enemy ships
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- battle_boats (0.0.5)
4
+ battle_boats (0.0.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,6 +1,8 @@
1
1
  require_relative "null_ship"
2
+ require_relative "colorize"
2
3
 
3
4
  module BattleBoats
5
+ using Colorize
4
6
  class Cell
5
7
  attr_accessor :occupant
6
8
 
@@ -23,7 +25,7 @@ module BattleBoats
23
25
  if hit?
24
26
  occupant.symbol
25
27
  else
26
- "."
28
+ ".".blue
27
29
  end
28
30
  end
29
31
 
@@ -0,0 +1,17 @@
1
+ module BattleBoats
2
+ module Colorize
3
+ refine String do
4
+ def blue
5
+ "\e[34m#{self}\e[0m"
6
+ end
7
+
8
+ def red
9
+ "\e[31m#{self}\e[0m"
10
+ end
11
+
12
+ def yellow
13
+ "\e[33m#{self}\e[0m"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,11 +1,14 @@
1
+ require_relative "colorize"
2
+
1
3
  module BattleBoats
4
+ using Colorize
2
5
  class NullShip
3
6
  attr_reader :name, :length, :symbol
4
7
 
5
8
  def initialize
6
9
  @name = "nothing"
7
10
  @length = 1
8
- @symbol = "X"
11
+ @symbol = "X".yellow
9
12
  end
10
13
 
11
14
  def empty?
@@ -1,11 +1,14 @@
1
+ require_relative "colorize"
2
+
1
3
  module BattleBoats
4
+ using Colorize
2
5
  class Ship
3
6
  attr_reader :name, :length, :symbol
4
7
 
5
8
  def initialize(name:, length:, symbol: "O")
6
9
  @name = name
7
10
  @length = length
8
- @symbol = symbol
11
+ @symbol = symbol.red
9
12
  end
10
13
 
11
14
  def empty?
@@ -1,3 +1,3 @@
1
1
  module BattleBoats
2
- VERSION = "0.0.5".freeze
2
+ VERSION = "0.0.6".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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Countz
@@ -108,6 +108,7 @@ files:
108
108
  - lib/battle_boats.rb
109
109
  - lib/battle_boats/board.rb
110
110
  - lib/battle_boats/cell.rb
111
+ - lib/battle_boats/colorize.rb
111
112
  - lib/battle_boats/console_ui.rb
112
113
  - lib/battle_boats/coordinate.rb
113
114
  - lib/battle_boats/engine.rb