codebreaker-ga 0.2.12 → 0.2.13

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: 48c9750495eb5845bf5309d9e1c626318334be0a147eac96db3a90903c0e46b5
4
- data.tar.gz: baf97c1de82cf4dbb7124bcb7d34d09b2f323c64a68dc04368008f5f8da95b96
3
+ metadata.gz: 831e9bd53f264f5b49dffecc33e55c150123aad91c710abad30d43760077e3de
4
+ data.tar.gz: b825d5fa996d38cae456a3877c1a72ccdcd77f6b85c6f8679f9e5a6cf41270e7
5
5
  SHA512:
6
- metadata.gz: dd855df8bdcba2ff0e71bc3e108938bec6d1ab430d0c9275f0949f02ed46c2735062a95d361b9b5528d7cdc7fe06355a21cbaa2cd55f17f670b984c41bc3aae4
7
- data.tar.gz: e263deb754196d46cd14c8f5ea5b9136199aeef03246713f63e8bc9f914c637dd670edf1e5960337f607b48fab2c386b3668400b9168661c86fb597fff695a8a
6
+ metadata.gz: b8601346ab07064cd8c54bf2916964817f9bdd157ffc197ff79855d91332561a1980edff48d58c081b3cdb3a3f04d5a4f773f0422ad56b1303771696d0fdd5f9
7
+ data.tar.gz: b61822b7bf0da2ccb8abbe76b71bbd2bfb5d77dd2752d087870b9d06cdae18bde6bede176cd98357688d6ba2403bf27c97d43f2465517af54a34c9e6fedef68e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codebreaker-ga (0.2.12)
4
+ codebreaker-ga (0.2.13)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -6,8 +6,8 @@ module Codebreaker
6
6
  CODE_LENGTH = 4
7
7
  CODE_NUMBERS = ('1'..'6').freeze
8
8
 
9
- attr_reader :statistic, :difficulties, :difficulty, :errors, :game_stage
10
- attr_accessor :user, :hint_code
9
+ attr_reader :statistic, :difficulties, :difficulty, :errors
10
+ attr_accessor :user, :hint_code, :game_stage, :secret_code
11
11
 
12
12
  def initialize
13
13
  @errors = {}
@@ -70,6 +70,7 @@ module Codebreaker
70
70
  end
71
71
 
72
72
  def statistic_save
73
+
73
74
  @statistic.statistic_add_item(name: user.username, difficulty: @difficulty, game_stage: @game_stage)
74
75
  @statistic.statistic_save
75
76
  end
@@ -4,11 +4,11 @@ module Codebreaker
4
4
  attr_accessor :hint_used
5
5
 
6
6
  def initialize(attempts:)
7
- @step_number = 1
8
- @endgame = false
9
7
  @attempts = attempts
10
8
  @compare_result = []
9
+ @endgame = false
11
10
  @hint_used = 0
11
+ @step_number = 1
12
12
  end
13
13
 
14
14
  def step(compare_result)
@@ -2,10 +2,11 @@ module Codebreaker
2
2
  class Statistic
3
3
  include YamlFile
4
4
 
5
- STAT_HEADER_LIST = %w[rating name difficulty attempts_total attempts_used hints_total hints_used].freeze
5
+ STAT_HEADER_LIST = %w[rating name difficulty attempts_total attempts_used hints_total hints_used date_saved].freeze
6
6
  STAT_FILE_PATH = 'statistic.yml'.freeze
7
+ DATETIME_FORMAT = "%Y.%m.%d - %H:%M:%S".freeze
7
8
 
8
- attr_reader :statistic, :headings
9
+ attr_reader :statistic, :headings, :statistic_items
9
10
  def initialize
10
11
  @headings = STAT_HEADER_LIST
11
12
  @statistic_items = []
@@ -26,7 +27,8 @@ module Codebreaker
26
27
  attempts_total: game_stage.attempts,
27
28
  attempts_used: game_stage.step_number,
28
29
  hints_total: difficulty.hints,
29
- hints_used: game_stage.hint_used }
30
+ hints_used: game_stage.hint_used,
31
+ date_saved: Time.now.strftime(DATETIME_FORMAT) }
30
32
  end
31
33
 
32
34
  def statistic_save
@@ -1,3 +1,3 @@
1
1
  module Codebreaker
2
- VERSION = '0.2.12'.freeze
2
+ VERSION = '0.2.13'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codebreaker-ga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - GorohovAlex
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-26 00:00:00.000000000 Z
11
+ date: 2020-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler