symbol-holic 0.0.0 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/symbol_holic +1 -1
- data/lib/menu.rb +5 -1
- data/lib/typing_statistics.rb +3 -5
- data/public/key_scores.json +0 -191
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 066ee2f7c66118bcea90bf1edcd422294b563d3b21a047186ca888547ca54167
|
4
|
+
data.tar.gz: fa6bbf8bf3d1a28ca7beb538982915addbb99dff0b234b1c76c909cfbfabc6ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76a0ac1f13e8bdb0f0b65a151cd2be1ab05a82d400c8e1db0e675fc2cd65e5eb262c7e8364919ee5d16e3914e5263c30d59e3642b20880f73e6247a0932cc320
|
7
|
+
data.tar.gz: b66e63a6b74f5fadf6db947e813f6465384cd51f4425acce68642b3cd4f3608b1ce2e9cfa2e1a7a48d5aefe8e5cc067417cb04c77dd41c0138cb4862064f1a15
|
data/bin/symbol_holic
CHANGED
@@ -12,7 +12,7 @@ require_relative '../lib/typing_statistics'
|
|
12
12
|
# Set the options for the OptionParser
|
13
13
|
parser = OptionParser.new do |opts|
|
14
14
|
# Print banner for users
|
15
|
-
opts.banner = 'Welcome to Symbol-holic! To run the program type:
|
15
|
+
opts.banner = 'Welcome to Symbol-holic! To run the program type: symbol_holic [options]'
|
16
16
|
# If user passes in -h or --help then display the help menu
|
17
17
|
opts.on('-h', '--help', 'Display the help menu') do
|
18
18
|
puts opts
|
data/lib/menu.rb
CHANGED
@@ -20,7 +20,9 @@ class Menu
|
|
20
20
|
{ name: 'Exit', value: '5' }
|
21
21
|
]
|
22
22
|
# TTY prompt with the menu choices, users can select one of these items
|
23
|
-
TTY::Prompt.new.select('
|
23
|
+
TTY::Prompt.new.select('
|
24
|
+
█▀ █▄█ █▀▄▀█ █▄▄ █▀█ █░░ ▄▄ █░█ █▀█ █░░ █ █▀▀
|
25
|
+
▄█ ░█░ █░▀░█ █▄█ █▄█ █▄▄ ░░ █▀█ █▄█ █▄▄ █ █▄▄', menu_choices)
|
24
26
|
end
|
25
27
|
|
26
28
|
# This is the loop which runs and displays the menu to the user
|
@@ -65,6 +67,7 @@ class Menu
|
|
65
67
|
@scores = @typing_game.run_game
|
66
68
|
# @scores eg {";"=>[1, 1, 51.413921326711545], ":"=>[1, 0, 79.55781654849564], "#"=>[2, 0, 164.6563074129133]}
|
67
69
|
@typing_statistics.statistics(@scores)
|
70
|
+
@typing_statistics.write_statistics
|
68
71
|
end
|
69
72
|
|
70
73
|
# Method for running the targeted typing game
|
@@ -72,6 +75,7 @@ class Menu
|
|
72
75
|
@typing_game = TypingGame.new
|
73
76
|
@scores = @typing_game.targeted_game
|
74
77
|
@typing_statistics.statistics(@scores)
|
78
|
+
@typing_statistics.write_statistics
|
75
79
|
end
|
76
80
|
|
77
81
|
# Menu option and TTY prompt for deleting all typing statistics
|
data/lib/typing_statistics.rb
CHANGED
@@ -2,10 +2,8 @@ require 'json'
|
|
2
2
|
require 'terminal-table'
|
3
3
|
require 'tty-pie'
|
4
4
|
require 'colorize'
|
5
|
-
require 'colorized_string'
|
6
5
|
require_relative 'typing_game'
|
7
6
|
require_relative 'statistics_helper'
|
8
|
-
require 'byebug'
|
9
7
|
class TypingStatistics
|
10
8
|
# The method for taking in the score of the game that the user just played
|
11
9
|
# It then inputs the score into the average statistics for the user
|
@@ -33,7 +31,7 @@ class TypingStatistics
|
|
33
31
|
@averaged_statistics[key][4] = average_wpm(@averaged_statistics[key][3], @averaged_statistics[key][0])
|
34
32
|
end
|
35
33
|
# Write the statistics at the end of each game into the JSON file
|
36
|
-
|
34
|
+
sort_averaged_statistics(@averaged_statistics)
|
37
35
|
end
|
38
36
|
|
39
37
|
# Total counter method to assist with setting the key values
|
@@ -75,8 +73,8 @@ class TypingStatistics
|
|
75
73
|
end
|
76
74
|
|
77
75
|
# Write the averaged_statistics hash to the JSON file
|
78
|
-
def write_statistics
|
79
|
-
File.write(file_path, JSON.pretty_generate(averaged_statistics))
|
76
|
+
def write_statistics
|
77
|
+
File.write(file_path, JSON.pretty_generate(@averaged_statistics))
|
80
78
|
end
|
81
79
|
|
82
80
|
# Make a pie chart for the hit and miss count
|
data/public/key_scores.json
CHANGED
@@ -1,191 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"]": [
|
3
|
-
1,
|
4
|
-
0,
|
5
|
-
100.0,
|
6
|
-
80.65385007368056,
|
7
|
-
80.7
|
8
|
-
],
|
9
|
-
"+": [
|
10
|
-
1,
|
11
|
-
0,
|
12
|
-
100.0,
|
13
|
-
80.44000343932484,
|
14
|
-
80.4
|
15
|
-
],
|
16
|
-
"=": [
|
17
|
-
1,
|
18
|
-
0,
|
19
|
-
100.0,
|
20
|
-
70.5913716690042,
|
21
|
-
70.6
|
22
|
-
],
|
23
|
-
":": [
|
24
|
-
1,
|
25
|
-
0,
|
26
|
-
100.0,
|
27
|
-
69.76731497920217,
|
28
|
-
69.8
|
29
|
-
],
|
30
|
-
"?": [
|
31
|
-
1,
|
32
|
-
0,
|
33
|
-
100.0,
|
34
|
-
65.65189953827343,
|
35
|
-
65.7
|
36
|
-
],
|
37
|
-
"!": [
|
38
|
-
1,
|
39
|
-
0,
|
40
|
-
100.0,
|
41
|
-
61.146865271855916,
|
42
|
-
61.1
|
43
|
-
],
|
44
|
-
"~": [
|
45
|
-
2,
|
46
|
-
0,
|
47
|
-
100.0,
|
48
|
-
121.33804636798443,
|
49
|
-
60.7
|
50
|
-
],
|
51
|
-
"<": [
|
52
|
-
1,
|
53
|
-
1,
|
54
|
-
50.0,
|
55
|
-
74.72060190202465,
|
56
|
-
74.7
|
57
|
-
],
|
58
|
-
"[": [
|
59
|
-
1,
|
60
|
-
1,
|
61
|
-
50.0,
|
62
|
-
48.07993942871095,
|
63
|
-
48.1
|
64
|
-
],
|
65
|
-
"#": [
|
66
|
-
1,
|
67
|
-
1,
|
68
|
-
50.0,
|
69
|
-
43.6055298977032,
|
70
|
-
43.6
|
71
|
-
],
|
72
|
-
";": [
|
73
|
-
1,
|
74
|
-
1,
|
75
|
-
50.0,
|
76
|
-
35.173707560569056,
|
77
|
-
35.2
|
78
|
-
],
|
79
|
-
"-": [
|
80
|
-
1,
|
81
|
-
1,
|
82
|
-
50.0,
|
83
|
-
33.937701778754736,
|
84
|
-
33.9
|
85
|
-
],
|
86
|
-
"|": [
|
87
|
-
2,
|
88
|
-
3,
|
89
|
-
40.0,
|
90
|
-
58.942454911783514,
|
91
|
-
29.5
|
92
|
-
],
|
93
|
-
"`": [
|
94
|
-
0,
|
95
|
-
0,
|
96
|
-
0,
|
97
|
-
0,
|
98
|
-
0
|
99
|
-
],
|
100
|
-
"%": [
|
101
|
-
0,
|
102
|
-
0,
|
103
|
-
0,
|
104
|
-
0,
|
105
|
-
0
|
106
|
-
],
|
107
|
-
"&": [
|
108
|
-
0,
|
109
|
-
0,
|
110
|
-
0,
|
111
|
-
0,
|
112
|
-
0
|
113
|
-
],
|
114
|
-
"{": [
|
115
|
-
0,
|
116
|
-
0,
|
117
|
-
0,
|
118
|
-
0,
|
119
|
-
0
|
120
|
-
],
|
121
|
-
"}": [
|
122
|
-
0,
|
123
|
-
0,
|
124
|
-
0,
|
125
|
-
0,
|
126
|
-
0
|
127
|
-
],
|
128
|
-
"(": [
|
129
|
-
0,
|
130
|
-
0,
|
131
|
-
0,
|
132
|
-
0,
|
133
|
-
0
|
134
|
-
],
|
135
|
-
"*": [
|
136
|
-
0,
|
137
|
-
0,
|
138
|
-
0,
|
139
|
-
0,
|
140
|
-
0
|
141
|
-
],
|
142
|
-
")": [
|
143
|
-
0,
|
144
|
-
0,
|
145
|
-
0,
|
146
|
-
0,
|
147
|
-
0
|
148
|
-
],
|
149
|
-
"_": [
|
150
|
-
0,
|
151
|
-
0,
|
152
|
-
0,
|
153
|
-
0,
|
154
|
-
0
|
155
|
-
],
|
156
|
-
"@": [
|
157
|
-
0,
|
158
|
-
0,
|
159
|
-
0,
|
160
|
-
0,
|
161
|
-
0
|
162
|
-
],
|
163
|
-
"^": [
|
164
|
-
0,
|
165
|
-
0,
|
166
|
-
0,
|
167
|
-
0,
|
168
|
-
0
|
169
|
-
],
|
170
|
-
"/": [
|
171
|
-
0,
|
172
|
-
0,
|
173
|
-
0,
|
174
|
-
0,
|
175
|
-
0
|
176
|
-
],
|
177
|
-
">": [
|
178
|
-
0,
|
179
|
-
0,
|
180
|
-
0,
|
181
|
-
0,
|
182
|
-
0
|
183
|
-
],
|
184
|
-
"$": [
|
185
|
-
0,
|
186
|
-
0,
|
187
|
-
0,
|
188
|
-
0,
|
189
|
-
0
|
190
|
-
]
|
191
|
-
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symbol-holic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rory Musinskas
|
@@ -10,6 +10,20 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: byebug
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 11.1.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 11.1.3
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: colorize
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,14 +76,14 @@ dependencies:
|
|
62
76
|
name: tty-pie
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
64
78
|
requirements:
|
65
|
-
- -
|
79
|
+
- - "~>"
|
66
80
|
- !ruby/object:Gem::Version
|
67
81
|
version: 0.4.0
|
68
82
|
type: :runtime
|
69
83
|
prerelease: false
|
70
84
|
version_requirements: !ruby/object:Gem::Requirement
|
71
85
|
requirements:
|
72
|
-
- -
|
86
|
+
- - "~>"
|
73
87
|
- !ruby/object:Gem::Version
|
74
88
|
version: 0.4.0
|
75
89
|
- !ruby/object:Gem::Dependency
|
@@ -86,20 +100,6 @@ dependencies:
|
|
86
100
|
- - "~>"
|
87
101
|
- !ruby/object:Gem::Version
|
88
102
|
version: 0.22.0
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: tty-reader
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 0.8.0
|
96
|
-
type: :runtime
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 0.8.0
|
103
103
|
description: A simple symbol typing game
|
104
104
|
email:
|
105
105
|
executables:
|
@@ -135,5 +135,5 @@ requirements: []
|
|
135
135
|
rubygems_version: 3.1.4
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
|
-
summary:
|
138
|
+
summary: Symbol-holic
|
139
139
|
test_files: []
|