codeguessing 0.3.0 → 0.3.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: d5a2a58a150dba74e9f58963a14232efe0dee761
4
- data.tar.gz: 951e826fa29482f88ec28cb346bebd7f7484eaeb
3
+ metadata.gz: f5f995c58157757c2bb029dfe79c0b502f55630a
4
+ data.tar.gz: f84b6142e9fc028e716b7db328f2e84be559a72f
5
5
  SHA512:
6
- metadata.gz: 18651820487e51cab59a3e4214a86812057c41dc78d215ab35aa65b5054bc412200449b9881374af7ee61a9eeb8b9b3bdc90375fa047310419b210d9ddd51bed
7
- data.tar.gz: 1f31add28d73efdf5b8e5ef81595597ed0220ebb75baaadd0e5e492cb551a9c57a164d352b55109ee6f78fa9ac72ce1664cb5852090e92d69919e9b3eb5dc11a
6
+ metadata.gz: b0520c2ba19395703254e8a046c4924337f7511aee93a940b29f06393ec34ad48027fbe2f4aed2215c643ded8144ad369f699e152bd6a023459b3a77272f75b4
7
+ data.tar.gz: 8cc9bec66b8262825f04e839613c7710ea49b9ac6c29242642520b53e519aa6c95af7540198488723e8c0a4d71d0867b8a6233d180694ee8ece2175485d15528
@@ -1,6 +1,6 @@
1
1
  module Codeguessing
2
2
  class Console
3
- def initialize(again = false, opt)
3
+ def initialize(again = false, opt = {})
4
4
  @path = File.join(File.dirname(__FILE__), 'scores.yml')
5
5
  @scores = load(@path)
6
6
  @game = Game.new(opt)
@@ -82,7 +82,7 @@ module Codeguessing
82
82
 
83
83
  def save(name = 'Anonim')
84
84
  return if @game.state != true
85
- @scores << @game.cur_score
85
+ @scores << @game.cur_score(name)
86
86
  File.new(@path, 'w') unless File.exist?(@path)
87
87
  File.open(@path, "r+") do |f|
88
88
  f.write(@scores.to_yaml)
@@ -1,6 +1,6 @@
1
1
  module Codeguessing
2
2
  class Game
3
- attr_reader :result, :attempts, :hint_count, :state
3
+ attr_reader :attempts, :hint_count, :state
4
4
  attr_accessor :secret_code
5
5
 
6
6
  MAX_HINT = 2
@@ -10,7 +10,7 @@ module Codeguessing
10
10
  @secret_code = opt[:secret_code] || random
11
11
  @attempts = opt[:attempts] || MAX_ATTEMPTS
12
12
  @hint_count = opt[:hint_count] || MAX_HINT
13
- @state = ''
13
+ @state = opt[:state] || ''
14
14
  end
15
15
 
16
16
  def guess(code)
@@ -49,9 +49,6 @@ module Codeguessing
49
49
  new_k = k.to_s.gsub('@','').to_sym
50
50
  hash[new_k] = self.instance_variable_get(k)
51
51
  end
52
- hash.delete(:scores)
53
- hash.delete(:result)
54
- hash.delete(:state)
55
52
  hash
56
53
  end
57
54
 
@@ -1,42 +1,6 @@
1
1
  ---
2
- - :secret_code: '2246'
3
- :attempts: 5
4
- :hint_count: 2
5
- :name: Yaroslav
6
- - :secret_code: '1121'
7
- :attempts: 5
8
- :hint_count: 2
9
- :name: Yaroslav
10
- - :secret_code: '2562'
11
- :attempts: 5
12
- :hint_count: 2
13
- :name: Yaroslav
14
- - :secret_code: '3445'
15
- :attempts: 5
16
- :hint_count: 2
17
- :name: Yaroslav
18
- - :secret_code: '2163'
19
- :attempts: 0
20
- :hint_count: 0
21
- :name: Yaroslav
22
- - :secret_code: '1234'
23
- :attempts: 4
24
- :hint_count: 2
25
- :name: dasdad
26
- - :secret_code: '1234'
27
- :attempts: 4
28
- :hint_count: 2
29
- :name: Y
30
- - Anonim
31
- - :secret_code: '1234'
32
- :attempts: 4
33
- :hint_count: 2
34
- :name: Anonim
35
- - :name: Anonim
2
+ - :name: Yaroslav
36
3
  :secret_code: '1234'
37
4
  :attempts: 4
38
5
  :hint_count: 2
39
- - :name: Anonim
40
- :secret_code: '1234'
41
- :attempts: 2
42
- :hint_count: 4
6
+ :state: true
@@ -1,3 +1,3 @@
1
1
  module Codeguessing
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeguessing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bezrukavyi