sea_battle 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -34,64 +34,65 @@ Or install it yourself as:
34
34
 
35
35
  ### Use class SeaBattle
36
36
 
37
- $ require "sea_battle"
37
+ $ require "sea_battle"
38
38
 
39
- $ first_board = SeaBattle::Board.new
40
- $ second_board = SeaBattle::Board.new
41
- $ sea_battle = SeaBattle.new(first_board, second_board)
39
+ $ first_board = SeaBattle::Board.new
40
+ $ second_board = SeaBattle::Board.new
41
+ $ sea_battle = SeaBattle.new(first_board, second_board)
42
42
 
43
43
  #### Game is activated?
44
- $ sea_battle.is_activated?
44
+ $ sea_battle.is_activated?
45
45
 
46
46
  #### You can get which player is active
47
- $ sea_battle.active_user #=> :first_player
47
+ $ sea_battle.active_user #=> :first_player
48
48
 
49
49
  #### Ship on position row, column is sunken?
50
- $ sea_battle.is_sunken_ship?(3, 7) #=> false
50
+ $ sea_battle.is_sunken_ship?(3, 7) #=> false
51
51
 
52
52
  #### You can attack position (row, column)
53
- $ sea_battle.move(:second_player, :attack, 2, 9)
53
+ $ sea_battle.move(:second_player, :attack, 2, 9)
54
54
 
55
55
  #### When game is over you can see winner
56
- $ sea_battle.winner_is #=> :first_player
56
+ $ sea_battle.winner_is #=> :first_player
57
57
 
58
58
  ### Play on console (min 92x40)
59
59
 
60
60
  $ sea_battle
61
61
 
62
- #=> SEA BATTLE
62
+ #=> SEA BATTLE
63
63
 
64
64
  #=> A B C D E F G H I J A B C D E F G H I J
65
65
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
66
- #=> 0 │ □ │ │ │ │ │ │ │ │ │ 0 │ │ │ │
66
+ #=> 0 │ • │ □ ││ │ │ │ ││ │ 0 │ │
67
67
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
68
- #=> 1 │ │ ││ ││ │ │ ⬤/│ │ 1 │ │ │ │ │ │ • │ ⬤/│ │ │
68
+ #=> 1 │ │ │ │ │ │ │ │ │ │ 1 │ │ │ │ ■ │ │ │ • │ │ │
69
69
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
70
- #=> 2 │ □ │ │ │ │ │ │ │ │ │ 2 │ │ │ │ │ │ ⬤/│ • │ • │
70
+ #=> 2 │ □ │ │ • │ │ │ │ • │2 ■ │ │ │ │ │ │ │
71
71
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
72
- #=> 3 │ │ • │ │ │ □ │ • │ • │ │ │ │ 3 │ • │ ⬤/│ • │ • │
72
+ #=> 3 │ │ • │ │ • │ │ □ │ • │ □ │ • │ 3 │ • │ • │ • │
73
73
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
74
- #=> 4 │ │ │ • │ │ │ │ 4 │ │ │ ⬤/│ ⬤/│ │ │ │ • │ │
74
+ #=> 4 │ │ • │ │ • │ │ │ ││ 4 ││ │ │ │ │ • │ ■ │
75
75
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
76
- #=> 5 │ │ • │ │ │ │ □ │ │ │ 5 │ │ │ │ │ │ │ • │ ⬤/│
76
+ #=> 5 ││ • ││ ││ □ │ ││ 5 │ │ │ ││ │ │ ■ │ • │ │
77
77
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
78
- #=> 6 │ • │ │ │ │ │ │ • │ • │ 6 │ │ │ │ │ │ │ • │ │ • │ │
78
+ #=> 6 ││ • │ │ │ │ • │ • │ │ │ │ 6 │ │ ││ • ││ • │ │ │ • │ • │
79
79
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
80
- #=> 7 │ │ │ │ • │ │ │ • ││ │ 7 │ │ │ │ │ │ │ │
80
+ #=> 7 │ │ ││ • ││ │ • │ │ │ 7 ││ │ │ ││ │ │
81
81
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
82
- #=> 8 │ │ │ │ • │ │ │ □ │ │ │ │ 8 │ │ │ │ • │ ⬤/│ • │ │ │ │ │
82
+ #=> 8 │ │ │ │ • │ │ │ │ │ • │ □ │ 8 │ │ │ │ │ │ │ │ • │ • │
83
83
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
84
- #=> 9 │ │ │ │ □ │ │ │ • │ 9 │ │ │ │ │ • │ │ │ │ │ │
84
+ #=> 9 │ │ ││ □ ││ ││ • │ 9 ││ ││ │ • ││ │ │ │ │
85
85
  #=> ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼ ┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼
86
-
87
- #=> 09:49:09 Computer: Moved on position 6j
88
- #=> 09:49:11 You: Moved on position 9e
89
- #=> 09:49:13 Computer: Moved on position 3b
90
- #=> 09:49:15 You: Used incorrect command: a
86
+ #=>
87
+ #=> 11:12:50 Computer: Moved on position 0d
88
+ #=> 11:12:50 You: Moved on position 3a
89
+ #=> 11:12:52 Computer: Moved on position 4i
90
+ #=> 11:12:52 You: Moved on position 4h
91
91
  #=> ____________________________________________________________
92
- #=> ⬤/ - sunk ship; ■ - hit ship; □ - selected ship; • - mishit
92
+ #=> - sunk ship; ■ - hit ship; □ - selected ship; • - mishit
93
93
 
94
94
  #=> (r)andom position into attack
95
95
  #=> 4a, 8i, ... - select part of ship
96
96
  #=> (e)xit of game
97
97
  #=> #=>
98
+
@@ -66,20 +66,20 @@ class SeaBattle
66
66
  unless cell.is_sunk?
67
67
  " ■ "
68
68
  else
69
- " "
69
+ " "
70
70
  end
71
71
  elsif cell.is_attacked? and not cell.is_in_ship?
72
72
  " • "
73
73
  elsif not cell.is_attacked? and cell.is_in_ship? and player == :first_player
74
74
  " □ "
75
75
  else
76
- " \u205f "
76
+ " "
77
77
  end
78
78
  end.join("│")
79
79
  end
80
80
 
81
81
  def info_command
82
- puts "⬤/ - sunk ship; ■ - hit ship; □ - selected ship; • - mishit"
82
+ puts " - sunk ship; ■ - hit ship; □ - selected ship; • - mishit"
83
83
  puts ""
84
84
  unless @sea_battle.is_activated?
85
85
  puts "(r)andom your ships on board"
@@ -1,3 +1,3 @@
1
1
  class SeaBattle
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -20,6 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_dependency "rspec", ">= 2.0.0"
23
- spec.add_dependency "rspec_progress"
24
23
  spec.add_development_dependency "rake"
25
24
  end
@@ -43,7 +43,7 @@ describe SeaBattle::GUI do
43
43
  gui.stub(:gets).and_return("a", "2b", "7c", "3a", "e")
44
44
  reset_content
45
45
  gui.play
46
- content.scan(/•|⬤/ ).should_not be_empty
46
+ content.scan(/•|※/).should_not be_empty
47
47
 
48
48
  end
49
49
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sea_battle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,22 +43,6 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: 2.0.0
46
- - !ruby/object:Gem::Dependency
47
- name: rspec_progress
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
46
  - !ruby/object:Gem::Dependency
63
47
  name: rake
64
48
  requirement: !ruby/object:Gem::Requirement