Ejemplo n.º 1
0
        /// <summary>
        /// Testar dina avancerade kunskaper.
        /// </summary>
        /// <param name="debugX">Vilken kolumn på consolen som texten ska läggas in i</param>
        /// <returns>Procentvärde av resultat.</returns>
        internal static double Avancerad(int debugX = 46)
        {
            const int max   = 15;
            var       score = 0;

            NiceDebug.Reset(debugX);
            var check = new CSRepAvancerad();

            score += VerifyInput(check.LessIsFirst(10, 2), 2, 10);
            score += VerifyInput(check.LessIsFirst(4, 3), 3, 4);
            score += VerifyInput(check.LessIsFirst(12, 22), 12, 22);

            score += VerifyInput(check.Swap("AA", "BB"), "BB", "AA");
            score += VerifyInput(check.Swap("Hej", "Ciao"), "Ciao", "Hej");
            score += VerifyInput(check.Swap("Katt", "Hund"), "Hund", "Katt");

            score += VerifyInput(check.LinQSum(2, 5, 23, 342, 12, 11, 24, 76), 495);
            score += VerifyInput(check.LinQAvg(2, 5, 23, 342, 12, 11, 24, 76), 61.875);

            score += VerifyInput(check.SortText("marcus"), "acmrsu");
            score += VerifyInput(check.SortText("jultomten"), "ejlmnottu");

            score += VerifyInput(check.FindWord(3, "Katt", "Hund", "Ros", "Röd ros", "Jultomte"), "Ros");
            score += VerifyInput(check.FindWord(5, "Elefant", "Tidtabell", "Planering", "Musik", "Spotify"), "Musik");

            score += VerifyInput(check.LinQHiscore(100, 32, 127, 95, 47, 89, 112), 127);
            score += VerifyInput(check.LinQWorstPlayer(100, 32, 127, 95, 47, 89, 112), 32);
            score += VerifyInput(check.IsLeet(100, 1773, 127, 95, 47, 89, 112), true);

            return(Math.Round((double)score / max * 100));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Testar dina ninjakunskaper.
        /// </summary>
        /// <param name="debugX">Debugtext position<see cref="int"/>.</param>
        /// <returns>Procentvärde av resultat.</returns>
        public static double Ninja(int debugX = 86)
        {
            Random    rnd   = new Random();
            const int max   = 8;
            int       score = 0;

            NiceDebug.Reset(debugX);
            score += Test("Doctor Who", rnd.Next(0, 29));
            score += Test("Doctor Strange", rnd.Next(0, 29));
            score += Test("Doctor Watson", rnd.Next(0, 29));
            score += Test("ZipaDee DooDah", -rnd.Next(0, 29));
            score += Test("Den spanska räven rev en annan räv", -rnd.Next(0, 29));
            score += Test("The quick brown fox jumps over the lazy dog", rnd.Next(0, 29));
            score += Test("Baskervilles hund", rnd.Next(0, 29));

            StringBuilder evilCheck = new StringBuilder("Flygande bäckasiner söka hwila på mjuka tuvor");

            for (int weird = 0; weird < evilCheck.Length; weird++)
            {
                evilCheck[weird] = rnd.Next(2) == 0 ?
                                   evilCheck[weird].ToString().ToUpper()[0] :
                                   evilCheck[weird].ToString().ToLower()[0];
            }

            score += Test(evilCheck.ToString(), rnd.Next(0, 29));

            return(Math.Round((double)score / max * 100));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Testar dina ninjakunskaper.
        /// </summary>
        /// <returns>Procentvärde av resultat.</returns>
        public static double Ninja(int debugX = 86)
        {
            var       rnd   = new Random();
            const int max   = 8;
            int       score = 0;

            NiceDebug.Reset(debugX);
            NiceDebug.MaxLength -= 4;
            var check = new CSRepvNinja();

            score += VerifyInput(check.TicTacToe(new string[] { "XOX", "O X", "OXO" }, 1, 1, 'X').ToLower(), "draw");
            score += VerifyInput(check.TicTacToe(new string[] { "XOX", "O X", "OXX" }, 1, 1, 'X').ToLower(), "x wins");
            score += VerifyInput(check.TicTacToe(new string[] { "X X", "OOX", "OXX" }, 1, 1, 'X').ToLower(), "error");
            score += VerifyInput(check.TicTacToe(new string[] { "X X", "OOX", "OXO" }, 0, 1, 'O').ToLower(), "draw");
            score += VerifyInput(check.TicTacToe(new string[] { "X X", "   ", "OXO" }, 0, 1, 'O').ToLower(), "next move");
            score += VerifyInput(check.TicTacToe(new string[] { "XOX", "OXO", "   " }, 2, 1, 'O').ToLower(), "next move");
            score += VerifyInput(check.TicTacToe(new string[] { "OOX", "OXO", "O X" }, 2, 1, 'X').ToLower(), "o wins");
            score += VerifyInput(check.TicTacToe(new string[] { "XOX", "OXO", "O O" }, 2, 1, 'X').ToLower(), "draw");

            return(Math.Round((double)score / max * 100));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Testar dina grundkunskaper.
        /// </summary>
        /// <returns>Procentvärde av resultat.</returns>
        public static double Grund(int debugX = 7)
        {
            const int max   = 9;
            int       score = 0;
            var       check = new CSRepvGrund();

            NiceDebug.Reset(debugX);

            score += VerifyInput(check.FörstaVärden(3, "A", "B", "C", "D", "Katt", "Hund"), "ABC");
            score += VerifyInput(check.FörstaVärden(9, "R", "A", "M", "M", "S", "T", "E", "I", "N", "Du Hast"), "RAMMSTEIN");

            score += VerifyInput(check.ForSkip(10, 3, '*'), new string('*', 6));
            score += VerifyInput(check.ForSkip(32, 7, '*'), new string('*', 27));

            score += VerifyInput(check.EleversBetyg("g", "G", "VG", "vg", "GV", "v", "V"), (2, 5));
            score += VerifyInput(check.EleversBetyg("vg", "vG", "G", "g", "V", "G", "v", "V", "VG", "KATT"), (3, 6));

            score += VerifyInput(check.VändPåOrdet("julafton"), "notfaluj");
            score += VerifyInput(check.VändPåOrdet("aluminium"), "muinimula");
            score += VerifyInput(check.VändPåOrdet("tacocat"), "tacocat");

            return(Math.Round((double)score / max * 100));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Testar dina grundkunskaper.
        /// </summary>
        /// <param name="debugX">Debugtext position<see cref="int"/>.</param>
        /// <returns>Procentvärde av resultat.</returns>
        public static double Grund(int debugX = 7)
        {
            const int  max   = 10;
            int        score = 0;
            CSRepGrund check = new CSRepGrund();

            NiceDebug.Reset(debugX);

            score += VerifyInput(check.SummeraText("112"), 4);
            score += VerifyInput(check.SummeraText("2+4=4"), 10);
            score += VerifyInput(check.SummeraText("*****@*****.**"), 21);
            score += VerifyInput(check.SummeraText("54.3"), 12);

            score += VerifyInput(check.Medelvärde(1, 4, 8, 12, 43, 12), 13);
            score += VerifyInput(check.Medelvärde(22, 32, 45, 67, 89, 11), 44);
            score += VerifyInput(check.Medelvärde(99, 44, 33, 22, 10), 41);
            score += VerifyInput(check.Medelvärde(10, 20), 15);

            score += VerifyInput(check.MinimiOchMaximiVärde(25, 234, 11, 4, 22), (4, 234));
            score += VerifyInput(check.MinimiOchMaximiVärde(-4, -22, -11, 0, 3), (-22, 3));

            return(Math.Round((double)score / max * 100));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Testar dina avancerade kunskaper.
        /// </summary>
        /// <param name="debugX">Debugtext position<see cref="int"/>.</param>
        /// <returns>Procentvärde av resultat.</returns>
        internal static double Avancerad(int debugX = 46)
        {
            const int max   = 11;
            int       score = 0;

            NiceDebug.Reset(debugX);
            CSRepAvancerad check = new CSRepAvancerad();

            score += VerifyInput(check.VarannanBokstav("Katt", "Hund"), "KHautntd");
            score += VerifyInput(check.VarannanBokstav("Nelson", "Mandela"), "NMealnsdoenla");
            score += VerifyInput(check.VarannanBokstav("Sherlock", "Holmes"), "SHhoelrmleosck");

            score += VerifyInput(check.AntalDagar(new DateTime(2020, 11, 18), new DateTime(2020, 12, 24)), 36);
            score += VerifyInput(check.AntalDagar(new DateTime(2020, 11, 18), new DateTime(2021, 12, 24)), 401);
            score += VerifyInput(check.AntalDagar(new DateTime(2020, 11, 11), new DateTime(2020, 12, 12)), 31);
            score += VerifyInput(check.AntalDagar(new DateTime(2020, 11, 18), new DateTime(2021, 1, 1)), 44);
            score += VerifyInput(check.AntalDagar(new DateTime(2021, 1, 1), new DateTime(2020, 1, 1)), -366);

            score += VerifyInput(check.LäggTillMånad(new DateTime(2020, 11, 18), 5), new DateTime(2021, 4, 18));
            score += VerifyInput(check.LäggTillMånad(new DateTime(2021, 11, 18), 2), new DateTime(2022, 01, 18));
            score += VerifyInput(check.LäggTillMånad(new DateTime(2021, 11, 18), -2), new DateTime(2021, 9, 18));

            return(Math.Round((double)score / max * 100));
        }