An Idea or Algorithm for displaying questions based on difficulty and user responses (C#) -
i'm trying create algorithm display set of questions user starting lowest difficulty , progressing difficulty level user answers questions correct , falling on difficulty level if user answers question wrong. haven't started code yet head start on how should tackle approach. general question model following.
public class question { public int questionid { get; set; } public string questiontext { get; set; } public int difficulty { get; set; } //can range 1 5 }
any suggestions on start?
public class question { public int questionid { get; set; } public string questiontext { get; set; } public int difficulty { get; set; } //can range 1 5 } public class user { public string name { get; set; } public int currentdifficulty { get; set; } public question current { get; set; } public hashset<question> answered { get; set; } } public class questiondata { private random rnd = new random(); public list<question> questions { get; private set; } public void load() { questions = new list<question>(); // load question data database or file } public question getnextquestion(user user) { list<question> possible = (from e in questions e.difficulty == user.currentdifficulty && !user.answered.contains(e) select e).tolist(); return possible.count == 0 ? null : possible[rnd.next(possible.count)]; } }
Comments
Post a Comment