bb_stats_crunch 0.0.8 → 0.0.10
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.
- data/lib/bb_stats_crunch.rb +31 -16
- metadata +2 -2
data/lib/bb_stats_crunch.rb
CHANGED
@@ -1,24 +1,39 @@
|
|
1
|
-
puts "Hello World"
|
2
|
-
puts "Hello World"
|
3
|
-
puts "Hello World"
|
4
|
-
|
5
|
-
require 'csv'
|
6
1
|
class BbStatsCrunch
|
7
|
-
attr_accessor :
|
2
|
+
attr_accessor :team1, :team2, :score1, :score2
|
8
3
|
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
require 'csv'
|
5
|
+
hometeam = 0
|
6
|
+
visteam = 0
|
7
|
+
puts "#{hometeam.class}"
|
12
8
|
|
13
|
-
def mood
|
14
|
-
"#{name} is always HAPPY!!"
|
15
|
-
end
|
16
9
|
|
17
10
|
module GetStats
|
18
|
-
|
19
|
-
|
20
|
-
|
11
|
+
hometeam, visteam, totalscore = 0, 0, 0
|
12
|
+
|
13
|
+
puts "enter year (valid year between 1960 - 1969)"
|
14
|
+
year = gets.chomp
|
15
|
+
teamwins = Hash.new("0")
|
16
|
+
puts year
|
17
|
+
|
18
|
+
CSV.foreach("files/GL#{year}.TXT") do |row|
|
19
|
+
team1 = row[3]
|
20
|
+
score1 = row[9].to_i
|
21
|
+
team2 = row[6]
|
22
|
+
score2 = row[10].to_i
|
23
|
+
totalscore = totalscore + score1 + score2
|
24
|
+
if score1 > score2
|
25
|
+
visteam += 1
|
26
|
+
# puts teamwins["#{team1}"]
|
27
|
+
# teamwins["#{team1}"]
|
28
|
+
# teamwins["#{team1}"] += 1
|
29
|
+
# puts @teamwins["#{team1}"]
|
30
|
+
else
|
31
|
+
hometeam += 1
|
32
|
+
end
|
21
33
|
end
|
34
|
+
puts "The home team won #{hometeam} times."
|
35
|
+
puts "The vistors won #{visteam} times."
|
36
|
+
puts "Total runs scored in #{year} was #{totalscore}."
|
37
|
+
|
22
38
|
end
|
23
39
|
end
|
24
|
-
|