Exemple #1
0
        static void Main(string[] args)
        {
            int i = 0;

            Console.WriteLine("Ludoterning:");
            LudoTerning l = new LudoTerning();

            Console.WriteLine(l.Værdi);
            Console.WriteLine(l.ErGlobus().ToString());
            Console.WriteLine(l.ErStjerne().ToString());
            l.Ryst();
            Console.WriteLine(l.Værdi);


            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.Black;
            Console.BackgroundColor = ConsoleColor.DarkRed;
            Console.WriteLine("Start globus loop");
            Console.ForegroundColor = ConsoleColor.White;
            Console.BackgroundColor = ConsoleColor.Black;
            while (l.ErGlobus() == false) //Loop bliver ved med at køre indtil, Ludoterning slår en globus.
            {
                i++;                      //Tæller antal ryst
                Console.WriteLine("antal ryst: " + i);
                l.Ryst();                 //Ryster ludoterning
                Console.WriteLine();
                Console.WriteLine();
            }


            Console.WriteLine();
            Console.WriteLine(l.ErGlobus().ToString());
            Console.WriteLine(l.Værdi);


            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Almindelig terning:");

            Terning t = new Terning();

            Console.WriteLine(t.Værdi);
            t.Ryst();
            Console.WriteLine(t.Værdi);



            // Keep console window open when using the debugger (F5)
            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.Write("Press any key to continue . . . ");
                Console.ReadKey();
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Terning t1 = new Terning();

            t1.Skriv();

            t1.Ryst();
            t1.Skriv();
            Terning t2 = new Terning(4);

            t2.Skriv();
            t2.Ryst();
            t2.Skriv();

            LudoTerning l1 = new LudoTerning();

            l1.Skriv();

            LudoTerning l2 = new LudoTerning(5);

            l2.Skriv();

            l2.Ryst();
            l2.Skriv();

            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.Write("Press any key to continue . . .");
                Console.ReadKey();
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Terning t = new Terning(2);

            t.Ryst();
            Console.WriteLine(t.Værdi);

            LudoTerning lt = new LudoTerning();

            while (true)
            {
                try
                {
                    Console.ReadKey();
                    lt.Ryst();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }