//_____________________________Method to add a single Memorandum object to Memo List________________________________________ public void addToMemo(int questionCount, String learnerAns, String learnersAnswer) { String correctAnswer = ""; bool isCorrect; if (QuestionsDictionary[questionCount].correctAns.Equals(learnerAns)) { isCorrect = true; } else { isCorrect = false; } switch (QuestionsDictionary[questionCount].correctAns) { case "A": { correctAnswer = "A) " + QuestionsDictionary[questionCount].ansA; break; } case "B": { correctAnswer = "B) " + QuestionsDictionary[questionCount].ansB; break; } case "C": { correctAnswer = "C) " + QuestionsDictionary[questionCount].ansC; break; } case "D": { correctAnswer = "D) " + QuestionsDictionary[questionCount].ansD; break; } default: { break; } } Memo.Add(new Memorandum { Question = QuestionsDictionary[questionCount].Quest, IsCorrect = isCorrect, LearnersAnswer = learnersAnswer, CorrectAnswer = correctAnswer, QuestionID = QuestionsDictionary[questionCount].QuestionID, userID = int.Parse(User.UserID), SelectedAnswer = learnerAns }); }
public GameState Guess(int guess) { var player0 = Players[0]; var otherPlayers = Players.Remove(player0); if (Memo.Count <= GuessPosition) { return(new GameState(TableId, otherPlayers.Add(player0), Memo.Add(guess), 0)); } return(Memo[GuessPosition] == guess ? new GameState(TableId, Players, Memo, GuessPosition + 1) : new GameState(TableId, otherPlayers, otherPlayers.Count <= 1 ? ImmutableList.Create <int>() : Memo, 0) ); }