symbol-holic 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/menu.rb +5 -1
- data/lib/typing_statistics.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f49cbbf9f557602ef79549dc4e88e398294d3cbc97896c4207437df3025b6c38
|
4
|
+
data.tar.gz: ab22542668fa35a3401a1b90965be32117c13285066cf6b7e622e7002c679050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07d51f051aa590adeb154fca6832ec2fc9616214ea8eabe70755430b2e901bfa837bde0ae6ff2bf86ee9e8b0ce5a7ecea917a734983f74923789d12aa4dbfaea
|
7
|
+
data.tar.gz: 3711ae94d1bb95aeecbd66fa37b5617dc53b97cbe15156b4fec765b77bc1deb8425461721dda7fe137bf3e95160cabe7af16182bac40d32e3a4690f5f4339df7
|
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,7 +2,7 @@ require 'json'
|
|
2
2
|
require 'terminal-table'
|
3
3
|
require 'tty-pie'
|
4
4
|
require 'colorize'
|
5
|
-
require '
|
5
|
+
require 'byebug'
|
6
6
|
require_relative 'typing_game'
|
7
7
|
require_relative 'statistics_helper'
|
8
8
|
class TypingStatistics
|
@@ -32,7 +32,7 @@ class TypingStatistics
|
|
32
32
|
@averaged_statistics[key][4] = average_wpm(@averaged_statistics[key][3], @averaged_statistics[key][0])
|
33
33
|
end
|
34
34
|
# Write the statistics at the end of each game into the JSON file
|
35
|
-
|
35
|
+
sort_averaged_statistics(@averaged_statistics)
|
36
36
|
end
|
37
37
|
|
38
38
|
# Total counter method to assist with setting the key values
|
@@ -74,8 +74,8 @@ class TypingStatistics
|
|
74
74
|
end
|
75
75
|
|
76
76
|
# Write the averaged_statistics hash to the JSON file
|
77
|
-
def write_statistics
|
78
|
-
File.write(file_path, JSON.pretty_generate(averaged_statistics))
|
77
|
+
def write_statistics
|
78
|
+
File.write(file_path, JSON.pretty_generate(@averaged_statistics))
|
79
79
|
end
|
80
80
|
|
81
81
|
# Make a pie chart for the hit and miss count
|