imitate baseball box scoring

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can't seem to get my mind around how to create a 'box score' style array. It would have two rows(batters) and 9 columns(innings) plus one at the end to use as a total. I would like each element of the array to store the number of pitches and number of hits per batter. Is this where an arraylist would come in handy and if so, can anyone give me a clue as to how to code it

Thanks in advance
 
Michael,

In this case, I would have a 2 x 9 array (the column being the players,
and the rows being the inning, or you can make it 9 x 2 if you want). In
each array element, I would have a class or structure that would expose
errors, runs, pitches, hits per batter, etc, etc, and then store THAT in the
array. Id then have a variable for each team storing the totals (they don't
belong in the array really).

Also, if this is related to baseball, you have to take into
consideration when the game goes into extra innings, so you might be better
off with an array list, where the index is the inning minus one (because it
is zero based), and each element in the ArrayList is a two dimensional
array, one for each team that inning.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

MichaelW said:
I can't seem to get my mind around how to create a 'box score' style
array. It would have two rows(batters) and 9 columns(innings) plus one at
the end to use as a total. I would like each element of the array to store
the number of pitches and number of hits per batter. Is this where an
arraylist would come in handy and if so, can anyone give me a clue as to how
to code it?
 
Back
Top