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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/codebreaker/game.rb +3 -2
- data/lib/codebreaker/game_stage.rb +2 -2
- data/lib/codebreaker/statistic.rb +5 -3
- data/lib/codebreaker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 831e9bd53f264f5b49dffecc33e55c150123aad91c710abad30d43760077e3de
|
4
|
+
data.tar.gz: b825d5fa996d38cae456a3877c1a72ccdcd77f6b85c6f8679f9e5a6cf41270e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8601346ab07064cd8c54bf2916964817f9bdd157ffc197ff79855d91332561a1980edff48d58c081b3cdb3a3f04d5a4f773f0422ad56b1303771696d0fdd5f9
|
7
|
+
data.tar.gz: b61822b7bf0da2ccb8abbe76b71bbd2bfb5d77dd2752d087870b9d06cdae18bde6bede176cd98357688d6ba2403bf27c97d43f2465517af54a34c9e6fedef68e
|
data/Gemfile.lock
CHANGED
data/lib/codebreaker/game.rb
CHANGED
@@ -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
|
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
|
data/lib/codebreaker/version.rb
CHANGED
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.
|
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:
|
11
|
+
date: 2020-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|