Example #1
0
        /// <summary>
        /// Demonstrates rolling and using two dice
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // initialize random number generator
            RandomNumberGenerator.Initialize();

            // create two dice

            //creating with one contructor for 6-sided
            Die die1 = new Die();
            //and for n-sided
            Die die2 = new Die(6);

            // tell the dice to roll themselves
            die1.Roll();
            die2.Roll();

            // print the top sides and the sum of the dice
            Console.WriteLine("Die1 topside is " + die1.TopSide);
            Console.WriteLine("Die2 topside is " + die2.TopSide);

            int sum = die1.TopSide + die2.TopSide;

            Console.WriteLine("Sum is " + sum);
            Console.WriteLine();
        }
Example #2
0
        /// <summary>
        /// Demonstrates rolling and using two dice
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // initialize random number generator
            RandomNumberGenerator.Initialize();

            // create two dice
            Die die1 = new Die();

            Die die2 = new Die();

            // tell the dice to roll themselves

            die1.Roll();
            int d1 = die1.TopSide;

            die2.Roll();
            int d2 = die2.TopSide;

            int sum = d1 + d2;

            // print the top sides and the sum of the dice


            Console.WriteLine("Die 1: " + d1);
            Console.WriteLine("Die 2: " + d2);
            Console.WriteLine("The sum the die 1 and die 2 is: " + sum);
            Console.WriteLine();
        }
Example #3
0
        /// <summary>
        /// Demonstrates rolling and using two dice
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // initialize random number generator
            RandomNumberGenerator.Initialize();

            // create two dice

            // tell the dice to roll themselves

            // print the top sides and the sum of the dice

            Console.WriteLine();
        }
Example #4
0
        /// <summary>
        /// Demonstrates rolling and using two dice
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // initialize random number generator
            RandomNumberGenerator.Initialize();

            // create two dice
            Die die1 = new Die();
            Die die2 = new Die();

            // tell the dice to roll themselves
            die1.Roll();
            die2.Roll();
            // print the top sides and the sum of the dice
            Console.WriteLine($"Die 1: {die1.TopSide} die 2: {die2.TopSide} sum: {die1.TopSide + die2.TopSide}");
            Console.WriteLine();
        }
Example #5
0
        /// <summary>
        /// Demonstrates rolling and using two dice
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // initialize random number generator
            RandomNumberGenerator.Initialize();

            // create two dice
            Die diceOne = new Die();
            Die diceTwo = new Die();

            // tell the dice to roll themselves
            diceOne.Roll();
            diceTwo.Roll();
            // print the top sides and the sum of the dice
            int sumOfDie = diceOne.TopSide + diceTwo.TopSide;

            Console.WriteLine("Dice 1: " + diceOne.TopSide + ", Dice 2: " + diceTwo.TopSide + ", Sum: " + sumOfDie);
        }
        /// <summary>
        /// Demonstrates rolling and using two dice
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // initialize random number generator
            RandomNumberGenerator.Initialize();

            // create two dice
            Die die1 = new Die();
            Die die2 = new Die();

            // tell the dice to roll themselves
            die1.Roll();
            die2.Roll();
            // print the top sides and the sum of the dice
            int d1 = die1.TopSide;
            int d2 = die2.TopSide;

            Console.WriteLine(d1);
            Console.WriteLine(d2);
            Console.WriteLine("the sum of the two dices is {0}", d1 + d2);
            Console.ReadLine();
        }
Example #7
0
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // initialize random number generator
            RandomNumberGenerator.Initialize();

            // create two dice
            Die die1 = new Die();
            Die die2 = new Die();

            // tell the dice to roll themselves
            die1.Roll();
            die2.Roll();

            // print the top sides and the sum of the dice
            int top1, top2, sum;

            top1 = die1.TopSide;
            top2 = die2.TopSide;
            sum  = top1 + top2;
            Console.WriteLine("The top face of die1 - " + top1);
            Console.WriteLine("The top face of die2 - " + top2);
            Console.WriteLine("The sum of the top faces - " + sum);
        }
Example #8
0
        /// <summary>
        /// Demonstrates rolling and using two dice
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // initialize random number generator
            RandomNumberGenerator.Initialize();

            // create two dice

            Die die1 = new Die();
            Die die2 = new Die();

            // tell the dice to roll themselves

            die1.Roll();
            die2.Roll();

            // print the top sides and the sum of the dice

            Console.WriteLine("Top side of Dice 1: " + die1.TopSide);
            Console.WriteLine("Top side of Dice 2: " + die2.TopSide);
            Console.WriteLine("Sum of both dice topsides: " + (die1.TopSide + die2.TopSide));

            Console.WriteLine();
        }
        /// <summary>
        /// Demonstrates rolling and using two dice
        /// </summary>
        /// <param name="args">command-line arguments</param>
        public static void Main(string[] args)
        {
            // initialize random number generator
            RandomNumberGenerator.Initialize();

            // create two dice
            Die die1 = new Die();
            Die die2 = new Die();

            // tell the dice to roll themselves
            die1.Roll();
            die2.Roll();

            // print the top sides and the sum of the dice



            Console.WriteLine(die1.TopSide);
            Console.WriteLine(die2.TopSide);

            int sum = die1.TopSide + die2.TopSide;

            Console.WriteLine(sum);

//
//			Console.WriteLine ();
//
//			for (int i = 30; i>=3; i-=3)  {
//				Console.WriteLine (i);
//
//			}
//
//			Console.WriteLine ();
//
//
//			plus (90);
//
//
//			int x = 3;
//			int y = 4;
//			float f, g, h;
//
//
//
//
//
//			f = x + y;
//
//			Console.WriteLine (f);
//
//			g = x - y;
//
//			Console.WriteLine (g);
//			h = (float) x / y;
//
//			Console.WriteLine (h);
//
//
//			Console.WriteLine ();
//        }
//
//		//new method
//		public static void plus(int y) {
//			Console.WriteLine(y + 2);
//
//		}
        }