コード例 #1
0
        static bool TestScenario2OK()
        {
            char[] openChordTest = new char[10];
            char[,] fretBoard = new char[6, 7];
            fretBoard         = OpenChords.Cmajor(OpenChords.ResetFretBoard(fretBoard));
            openChordTest[0]  = fretBoard[4, 2];
            fretBoard         = OpenChords.Dminor(OpenChords.ResetFretBoard(fretBoard));
            openChordTest[1]  = fretBoard[1, 2];
            fretBoard         = OpenChords.Eminor(OpenChords.ResetFretBoard(fretBoard));
            openChordTest[2]  = fretBoard[4, 1];
            fretBoard         = OpenChords.Fmajor(OpenChords.ResetFretBoard(fretBoard));
            openChordTest[3]  = fretBoard[3, 2];
            fretBoard         = OpenChords.Gmajor(OpenChords.ResetFretBoard(fretBoard));
            openChordTest[4]  = fretBoard[5, 2];
            fretBoard         = OpenChords.Aminor(OpenChords.ResetFretBoard(fretBoard));
            openChordTest[5]  = fretBoard[3, 1];
            fretBoard         = OpenChords.Amajor(OpenChords.ResetFretBoard(fretBoard));
            openChordTest[6]  = fretBoard[3, 1];
            fretBoard         = OpenChords.Emajor(OpenChords.ResetFretBoard(fretBoard));
            openChordTest[7]  = fretBoard[4, 1];
            fretBoard         = OpenChords.Dmajor(OpenChords.ResetFretBoard(fretBoard));
            openChordTest[8]  = fretBoard[1, 2];
            fretBoard         = OpenChords.Fminor(OpenChords.ResetFretBoard(fretBoard));
            openChordTest[9]  = fretBoard[3, 2];
            Random rand = new Random();
            int    k    = rand.Next() % 10;

            return(openChordTest[k] == 'O');
        }
コード例 #2
0
        static void EasyLevelQuestions(char[,] fretBoard, int fret, ref int correct)
        {
            int correct = 0;
            int n       = 10;

            int[] chosenQuestions = RandomQuestions(n);
            for (int i = 0; i < 4; ++i)
            {
                Console.WriteLine("Question{0}", i + 1);
                switch (chosenQuestions[i])
                {
                case 1:
                    fretBoard = OpenChords.Cmajor(OpenChords.ResetFretBoard(fretBoard));
                    DisplayFretBoard(fretBoard, fret);
                    Console.WriteLine("What chord is this?" + '\n' + "(1) C  (2) Am  (3) G");
                    int ans1 = int.Parse(Console.ReadLine());
                    if (ans1 != 1)
                    {
                        Console.WriteLine("Wrong answer! This is a C chord.");
                    }
                    else
                    {
                        Console.WriteLine("Correct!");
                        ++correct;
                    }
                    break;

                case 2:
                    fretBoard = OpenChords.Dminor(OpenChords.ResetFretBoard(fretBoard));
                    DisplayFretBoard(fretBoard, fret);
                    Console.WriteLine("What chord is this?" + '\n' + "(1) F  (2) Em  (3) Dm");
                    int ans2 = int.Parse(Console.ReadLine());
                    if (ans2 != 3)
                    {
                        Console.WriteLine("Wrong answer! This is a Dm chord.");
                    }
                    else
                    {
                        Console.WriteLine("Correct!");
                        ++correct;
                    }
                    break;

                case 3:
                    fretBoard = OpenChords.Eminor(OpenChords.ResetFretBoard(fretBoard));
                    DisplayFretBoard(fretBoard, fret);
                    Console.WriteLine("What chord is this?" + '\n' + "(1) Fm  (2) Em  (3) A");
                    int ans3 = int.Parse(Console.ReadLine());
                    if (ans3 != 2)
                    {
                        Console.WriteLine("Wrong answer! This is a Em chord.");
                    }
                    else
                    {
                        Console.WriteLine("Correct!");
                        ++correct;
                    }
                    break;

                case 4:
                    fretBoard = OpenChords.Fmajor(OpenChords.ResetFretBoard(fretBoard));
                    DisplayFretBoard(fretBoard, fret);
                    Console.WriteLine("What chord is this?" + '\n' + "(1) F  (2) Fm  (3) E");
                    int ans4 = int.Parse(Console.ReadLine());
                    if (ans4 != 1)
                    {
                        Console.WriteLine("Wrong answer! This is a F chord.");
                    }
                    else
                    {
                        Console.WriteLine("Correct!");
                        ++correct;
                    }
                    break;

                case 5:
                    fretBoard = OpenChords.Gmajor(OpenChords.ResetFretBoard(fretBoard));
                    DisplayFretBoard(fretBoard, fret);
                    Console.WriteLine("What chord is this?" + '\n' + "(1) Dm  (2) G  (3) C");
                    int ans5 = int.Parse(Console.ReadLine());
                    if (ans5 != 2)
                    {
                        Console.WriteLine("Wrong answer! This is a G chord.");
                    }
                    else
                    {
                        Console.WriteLine("Correct!");
                        ++correct;
                    }
                    break;

                case 6:
                    fretBoard = OpenChords.Aminor(OpenChords.ResetFretBoard(fretBoard));
                    DisplayFretBoard(fretBoard, fret);
                    Console.WriteLine("What chord is this?" + '\n' + "(1) Em  (2) A  (3) Am");
                    int ans6 = int.Parse(Console.ReadLine());
                    if (ans6 != 3)
                    {
                        Console.WriteLine("Wrong answer! This is a Am chord.");
                    }
                    else
                    {
                        Console.WriteLine("Correct!");
                        ++correct;
                    }
                    break;

                case 7:
                    fretBoard = OpenChords.Amajor(OpenChords.ResetFretBoard(fretBoard));
                    DisplayFretBoard(fretBoard, fret);
                    Console.WriteLine("What chord is this?" + '\n' + "(1) Fm  (2) A  (3) E");
                    int ans7 = int.Parse(Console.ReadLine());
                    if (ans7 != 2)
                    {
                        Console.WriteLine("Wrong answer! This is a A chord.");
                    }
                    else
                    {
                        Console.WriteLine("Correct!");
                        ++correct;
                    }
                    break;

                case 8:
                    fretBoard = OpenChords.Emajor(OpenChords.ResetFretBoard(fretBoard));
                    DisplayFretBoard(fretBoard, fret);
                    Console.WriteLine("What chord is this?" + '\n' + "(1) D  (2) F  (3) E");
                    int ans8 = int.Parse(Console.ReadLine());
                    if (ans8 != 3)
                    {
                        Console.WriteLine("Wrong answer! This is a E chord.");
                    }
                    else
                    {
                        Console.WriteLine("Correct!");
                        ++correct;
                    }
                    break;

                case 9:
                    fretBoard = OpenChords.Dmajor(OpenChords.ResetFretBoard(fretBoard));
                    DisplayFretBoard(fretBoard, fret);
                    Console.WriteLine("What chord is this?" + '\n' + "(1) D  (2) Dm  (3) Em");
                    int ans9 = int.Parse(Console.ReadLine());
                    if (ans9 != 1)
                    {
                        Console.WriteLine("Wrong answer! This is a D chord.");
                    }
                    else
                    {
                        Console.WriteLine("Correct!");
                        ++correct;
                    }
                    break;

                case 10:
                    fretBoard = OpenChords.Fminor(OpenChords.ResetFretBoard(fretBoard));
                    DisplayFretBoard(fretBoard, fret);
                    Console.WriteLine("What chord is this?" + '\n' + "(1) Fm  (2) Em  (3) Am");
                    int ans10 = int.Parse(Console.ReadLine());
                    if (ans10 != 1)
                    {
                        Console.WriteLine("Wrong answer! This is a Fm chord.");
                    }
                    else
                    {
                        Console.WriteLine("Correct!");
                        ++correct;
                    }
                    break;
                }
            }
        }