I'm making an application for a game that has many questions per round. Each player can answer the question (multiple players can answer the same question) and receive a varying amount of points. The app has a list of players and a list of questions at the start.
I'm not sure how to model this - I was considering that each Question could have a dictionary , key of Player object and value of how many points they got. I also considered having a dictionary for each player that has a key of Question object and value of points (if they didn't answer then that Question isn't a key).
I'm not sure which is the best option or if there's a better way to do this. Is it a good idea to have many Question object copies floating around for many players (or vice-versa, for the other option)?
In my AngularJS factory I made a Player class:
function Player(name, heard) {
this.name = name;
this.heard = heard;
}
and a QuestionList and Question classes
function Question(number) {
this.number = number;
}
function QuestionList() {
this.questions;
}
QuestionList.prototype.createQuestions(n) {
for (var i = 0; i < n; i++)
this.questions.push(new Question(i + 1));
}
How do I relate them? Any help would be appreciated, thanks.
answersarray as a property of theplayer? Each item in the array could contain the question (either question object reference or id number), the answer chosen, the points earned, the time answered, etc.