public async Task InitializeCurrentTriviaQuestion(TriviaTable table, string topic) { table.CurrentTriviaQuestion = await triviaManager.GetNewQuestion(topic); table.HintCommandsCount = 0; InitializeHintsForCurrentQuestion(table); }
private static void CreateMainTriviaTable() { var mainTable = new TriviaTable { TableName = "Public Table", Topic = "Superman" }; TriviaUserHandler.TriviaTables.Add(mainTable); }
private async Task <Response> CreateNewTable(string tableName, string topic) { var newTable = new TriviaTable { TableName = tableName, Topic = topic }; TriviaUserHandler.TriviaTables.Add(newTable); await triviaCore.InitializeCurrentTriviaQuestion(newTable, topic); return(HttpStatusCode.OK); }
private static void InitializeHintsForCurrentQuestion(TriviaTable table) { var answer = table.CurrentTriviaQuestion.Answer; var hint1 = TriviaHintGenerator.GenerateHintForQuestion(answer); var hint2 = TriviaHintGenerator.GenerateHintForQuestion(answer, hint1); var hint3 = TriviaHintGenerator.GenerateHintForQuestion(answer, hint2); table.CurrentTriviaQuestion.Hint = new QuestionHint() { FirstHint = hint1, SecondHint = hint2, ThirdHint = hint3 }; }
private static int GetAwardedPoints(TriviaTable triviaTable) { var hintsGiven = triviaTable.HintCommandsCount; switch (hintsGiven) { case 3: return(5); case 2: return(10); case 1: return(15); case 0: return(25); default: return(0); } }