codebreaker-d3n 0.1.8 → 0.1.9

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
  SHA256:
3
- metadata.gz: ce3c82668998d9887a3a251a30cb65b50a11065c478384725b2c14ecc150652c
4
- data.tar.gz: 2ac11423b170b9cede68442cbf9220169cbba7c9a85672e34f45d2e13c05e532
3
+ metadata.gz: f49dbd4c3857d46763fce325d8124ebd3122d043a9e24aa6b26cfea374622e0f
4
+ data.tar.gz: dfa8bbbd2f0202af790ce69ff3dd47e816ccc1d09c385b315d854baa94e0772a
5
5
  SHA512:
6
- metadata.gz: fd9f65cf07b676d257dd7b46648caf77ffc627b0000dd3ac64443000b4d7d8a47de64cd2bea2eaa4d6611464af567c133b0ef67719ed51eae649a3780c6b64ca
7
- data.tar.gz: 88adfce3215d07b5afc9ee01019c54986139cafeb5e0dcb5f0ffb2f647efa55d2751e86de82d400a1e92ea3746fe73cfa7edb74f557169428da17a4ca0c9b6eb
6
+ metadata.gz: 8951da49533f949d34f2ee6c728dccbdcd0c13d79d95abada257925a6588fd6d163691cc960d165bedb1f488140dec2dbbb254e2b439bffe54b850a61528ae9f
7
+ data.tar.gz: 5ebcbd91edb9680a73262af49d591ed346d230ae86897302050b7776482e7acff3dfed847b22eed0041e1bcbbf6c9ba4d0d71df988c27e0346efaadf60ce3e03
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codebreaker-d3n (0.1.2)
4
+ codebreaker-d3n (0.1.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -3,7 +3,8 @@
3
3
  module Codebreaker
4
4
  class Game
5
5
  include Validations
6
- attr_reader :difficulty, :errors, :secret_code
6
+ attr_reader :difficulty, :errors, :secret_code, :result, :hints, :attempts_total, :hint_keeper,
7
+ :attempts_used, :attempts_available, :hints_total, :hints_used, :hints_available
7
8
 
8
9
  CODE_DIGITS = (1..6).freeze
9
10
  CODE_LENGTH = 4
@@ -55,7 +56,8 @@ module Codebreaker
55
56
  end
56
57
 
57
58
  def hint
58
- @hints.pop
59
+ @hint_keeper << tip = @hints.pop
60
+ tip
59
61
  end
60
62
 
61
63
  def hints_left?
@@ -68,6 +70,19 @@ module Codebreaker
68
70
  @difficulty = LEVELS.dig(input.to_sym, :command)
69
71
  @hints = @secret_code.sample(LEVELS.dig(@difficulty.to_sym, :hints))
70
72
  @attempts = LEVELS.dig(@difficulty.to_sym, :attempts)
73
+ @hint_keeper = []
74
+ end
75
+
76
+ def attempts_calculations
77
+ @attempts_total = LEVELS.dig(@difficulty.to_sym, :attempts)
78
+ @attempts_used = LEVELS.dig(@difficulty.to_sym, :attempts) - @attempts
79
+ @attempts_available = @attempts_total - @attempts_used
80
+ end
81
+
82
+ def hints_calculations
83
+ @hints_total = LEVELS.dig(@difficulty.to_sym, :hints)
84
+ @hints_used = LEVELS.dig(@difficulty.to_sym, :hints) - @hints.size
85
+ @hints_available = @hints_total - @hints_used
71
86
  end
72
87
 
73
88
  def to_h(name)
@@ -75,9 +90,9 @@ module Codebreaker
75
90
  name: name,
76
91
  difficulty: @difficulty,
77
92
  attempts_total: LEVELS.dig(@difficulty.to_sym, :attempts),
78
- attempts_used: (LEVELS.dig(@difficulty.to_sym, :attempts) - @attempts),
93
+ attempts_used: LEVELS.dig(@difficulty.to_sym, :attempts) - @attempts,
79
94
  hints_total: LEVELS.dig(@difficulty.to_sym, :hints),
80
- hints_used: (LEVELS.dig(@difficulty.to_sym, :hints) - @hints.size)
95
+ hints_used: LEVELS.dig(@difficulty.to_sym, :hints) - @hints.size
81
96
  }
82
97
  end
83
98
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Codebreaker
4
- VERSION = '0.1.8'
4
+ VERSION = '0.1.9'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebreaker-d3n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denny_Dee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-13 00:00:00.000000000 Z
11
+ date: 2019-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler