示例#1
0
 public static void DisplayEnding()
 {
     DisplayAlternatingSymbols('*');
     TransitionEffectHalfConsole();
     GameHelpers.PrintSlow(". . . . . . . . ", 150);
     GameHelpers.PrintSlow("Good bye!");
     Thread.Sleep(1000);
 }
示例#2
0
 internal void Play()
 {
     SetUpQuestions();
     StartQuiz();
     GameHelpers.PrintSlow(GradeQuiz());
     GameHelpers.PrintSlow("\n\nGame is about to end");
     GameHelpers.PrintSlow(" . . . . . . . .", 100);
 }
示例#3
0
 protected virtual void MakePossibleAnswers(int numberOfPossibleAnswers)
 {
     Console.Clear();
     GameHelpers.PrintSlow(string.Format("Enter {0} possible answers\n", numberOfPossibleAnswers));
     for (int i = 0; i < numberOfPossibleAnswers; i++)
     {
         Console.Write("{0}: ", i + 1);
         Answers.Add(new Answer(i + 1, Console.ReadLine()));
     }
 }
示例#4
0
        public static void TransitionEffect(string prompt)
        {
            for (int m = 0; m < Console.WindowWidth / 4; m++)
            {
                Console.Write(" ");
            }
            GameHelpers.PrintSlow(prompt);
            Console.WriteLine();
            for (int m = 0; m < Console.WindowWidth / 5; m++)
            {
                Console.Write(" ");
            }
            GameHelpers.PrintSlow("If you did not want to begin, sorry, you're stuck unless you close the console :)");
            Console.ReadLine();
            Thread.Sleep(250);

            TransitionEffectHalfConsole();
        }
示例#5
0
        // do not use, must refactor for use with CheckBoxes
        //public List<char> ChooseAnswer(Question question)
        //{
        //    List<char> choices;
        //    Console.Write("Enter your choice or choice(s) [if more than one just group it i.e. 123]: ");
        //    do
        //    {
        //        string input = Console.ReadLine();
        //        choices = input.ToList();
        //    } while (choices.Contains(',') || choices.Contains(' ') || !(choices.TrueForAll(key => char.IsDigit(key) ? !(int.Parse(key.ToString()) < 1 || int.Parse(key.ToString()) > question.Answers.Count) : false )));

        //    return choices;
        //}

        private string GradeQuiz()
        {
            Console.Clear();
            IList <Answer> correct = UserChoices.FindAll(answer => answer.IsCorrectAnswer);

            Correct = QuizGrader((double)correct.Count, (double)UserChoices.Count);

            GameHelpers.PrintSlow("Grading quiz");

            for (int i = 0; i < 5; i++)
            {
                Thread.Sleep(250);
                Console.Write(" .");
            }
            GameHelpers.PrintSlow(" Done!\nNow for the moment of truth, see results below\n");

            string result = string.Format("Result: {0} out of {1} correct: {2:P}", correct.Count, UserChoices.Count, Correct);

            return(result);
        }