Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("A Simulation of ROLLING DIE \n");
            Console.ResetColor();

            Random   rd  = new Random();
            DieEvent die = new DieEvent();

            die.TwoFour     += TwoFour_Handler;
            die.MoreThwenty += MoreThanTwenty_Handler;

            List <int> dieList = new List <int>();

            for (int i = 0; i < 50; i++)
            {
                die.Die(rd);
                dieList.Add(die.value);
                Thread.Sleep(100);
            }
            Console.WriteLine();

            die.InvokeTwoFour(die, dieList);
            die.InvokeMoreThanTwenty(die, dieList);
            Console.WriteLine();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method that throws the die as much as we want.
        /// </summary>
        /// <param name="die"></param>
        /// <param name="i"></param>
        static List <int> MixThrow(DieEvent die, int i)
        {
            List <int> dieList = new List <int>();
            Random     rd      = new Random();

            for (int k = i; k > 0; k--)
            {
                die.Die(rd);
                dieList.Add(die.value);
            }
            return(dieList);
        }