cinch_hangman 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.markdown CHANGED
@@ -28,7 +28,7 @@ compactcode: !hang new #channel secret
28
28
  The game will be started in the specified channel.
29
29
 
30
30
  ```
31
- bot: (s_____) handman started.
31
+ bot: (s_____) hangman started.
32
32
  compactcode: !hang guess s
33
33
  bot: (s_____) 6 guesses left.
34
34
  ```
@@ -12,22 +12,25 @@ module CinchHangman
12
12
  def describe
13
13
  if @guesses.empty?
14
14
  "(#{hint}) hangman started."
15
- elsif solved
15
+ elsif solved?
16
16
  "(#{@answer}) was solved!"
17
17
  elsif guesses_left <= 0
18
18
  "(#{@answer}) was too difficult!"
19
19
  else
20
- "(#{hint}) #{guesses_left} guesses left."
20
+ "(#{hint}) #{guesses_left} guesses left, guessed: #{incorrect_guesses.join}"
21
21
  end
22
22
  end
23
- def solved
23
+ def solved?
24
24
  !hint.include?(MASK)
25
25
  end
26
26
  def guesses_left
27
- @max_guesses - @guesses.gsub(/[#{@answer}]/, "").size
27
+ @max_guesses - incorrect_guesses.size
28
28
  end
29
29
  def hint
30
30
  @answer.gsub(/[^\s#{@guesses}]/, MASK)
31
31
  end
32
+ def incorrect_guesses
33
+ @guesses.gsub(/[#{@answer}]/, "").split(//).sort
34
+ end
32
35
  end
33
36
  end
@@ -1,3 +1,3 @@
1
1
  module CinchHangman
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/spec/game_spec.rb CHANGED
@@ -43,6 +43,13 @@ describe CinchHangman::Game do
43
43
  subject.describe.should include '3 guesses'
44
44
  end
45
45
  end
46
+ describe 'strikeouts' do
47
+ it 'already guessed letters' do
48
+ subject.guess("b")
49
+ subject.guess("a")
50
+ subject.describe.should include 'guessed: ab'
51
+ end
52
+ end
46
53
  end
47
54
  describe 'hints' do
48
55
  it 'show the number of letters in the answer' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinch_hangman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-10 00:00:00.000000000Z
12
+ date: 2011-09-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cinch
16
- requirement: &2162224980 !ruby/object:Gem::Requirement
16
+ requirement: &2169564320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2162224980
24
+ version_requirements: *2169564320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2162224340 !ruby/object:Gem::Requirement
27
+ requirement: &2169563840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2162224340
35
+ version_requirements: *2169563840
36
36
  description:
37
37
  email:
38
38
  - shanonmcquay@gmail.com
@@ -64,7 +64,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
64
64
  version: '0'
65
65
  segments:
66
66
  - 0
67
- hash: -2369301778940008582
67
+ hash: 4239588220923122799
68
68
  required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  none: false
70
70
  requirements:
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  segments:
75
75
  - 0
76
- hash: -2369301778940008582
76
+ hash: 4239588220923122799
77
77
  requirements: []
78
78
  rubyforge_project: cinch_hangman
79
79
  rubygems_version: 1.8.6