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.
Files changed (2) hide show
  1. data/lib/bb_stats_crunch.rb +31 -16
  2. metadata +2 -2
@@ -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 :name
2
+ attr_accessor :team1, :team2, :score1, :score2
8
3
 
9
- def initialize name
10
- @name = name
11
- end
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
- @stats = {}
19
- CSV.foreach("files/GL1969.TXT") do |row|
20
- puts row
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
-
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 10
9
+ version: 0.0.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jack Howland