I'm trying to represent a scoreboard for a competition and am struggling with the best data structures to use.
I have a list of Player objects, a list of Round objects, and for each combination, I need to store a RoundScore object (there are various parts to the score for a round).
What I'd like is some overall Scoreboard object where the following holds:
1 - I can access a collection of RoundScore objects identified by Round keys by providing a Player object. For example, maybe something like:
public IDictionary<Round,RoundScore> PlayerScores(Player player) { ... }
2 - I can access a collection of RoundScore objects identified by Player keys by providing a Round object. e.g:
public IDictionary<Player,RoundScore> RoundScores(Round round) { ... }
3 - I can access a single RoundScore object by providing a Player and a Round
4 - I can add a new Round and all Players will get a new RoundScore for that round with default values
5 - Similarly, I can add a new Player and all Rounds will have a new RoundScore for that player with default values
I guess what I'm really looking for is a representation of a grid with Rounds on one axis, Players on the other, and RoundScores in the middle.
Is there any data structure (or combination of data structures) already in .Net that I can use for this or will I have to roll my own?