예제 #1
0
        public async Task InitializeCurrentTriviaQuestion(TriviaTable table, string topic)
        {
            table.CurrentTriviaQuestion = await triviaManager.GetNewQuestion(topic);

            table.HintCommandsCount = 0;
            InitializeHintsForCurrentQuestion(table);
        }
예제 #2
0
        private static void CreateMainTriviaTable()
        {
            var mainTable = new TriviaTable
            {
                TableName = "Public Table",
                Topic     = "Superman"
            };

            TriviaUserHandler.TriviaTables.Add(mainTable);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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
            };
        }
예제 #5
0
        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);
            }
        }