Esempio n. 1
0
        public void move()
        {
            die1.roll();
            die2.roll();
            //move distance is total of both throws
            int iMoveDistance = die1.roll() + die2.roll();

            //increase location
            this.setLocation(this.getLocation() + iMoveDistance);
            this.lastMove = iMoveDistance;
        }
Esempio n. 2
0
 public void testToString()
 {
     Die die = new Die();
    //test that toString converts last roll of die same as converting result of roll to string
     int roll = die.roll();
     Assert.AreEqual(roll.ToString(), die.ToString());
 }
Esempio n. 3
0
        public void testToString()
        {
            Die die = new Die();
            //test that toString converts last roll of die same as converting result of roll to string
            int roll = die.roll();

            Assert.AreEqual(roll.ToString(), die.ToString());
        }
 public void TestDieRollRange()
 {
     Die die = new Die();
        int roll = die.roll();
        //Test that roll is between 1 & 6
     Assert.LessOrEqual(roll, 6);
        Assert.GreaterOrEqual(roll, 1);
 }
Esempio n. 5
0
 public void testRandomnessRandomOutputManyDice()
 {
     Console.WriteLine("Random Numbers: ");
     for (int i = 0; i < 1000; i++)
     {
         Die die = new Die();
         Console.WriteLine(die.roll().ToString());//outputs 1000 random numbers
     }
 }
Esempio n. 6
0
        public void TestDieRollRange()
        {
            Die die  = new Die();
            int roll = die.roll();

            //Test that roll is between 1 & 6
            Assert.LessOrEqual(roll, 6);
            Assert.GreaterOrEqual(roll, 1);
        }
        public void testRandomness4Fail1in6()
        {
            //Test randomness that should fail on average 1 in 6 times
            Die die = new Die();

            int numberToTest = 4;
            int roll = die.roll();
            Assert.AreNotEqual(roll, numberToTest);
            numberToTest = roll;
        }
Esempio n. 8
0
 public void testRandomnessRandomOutputManyDice()
 {
    
     Console.WriteLine("Random Numbers: ");
     for (int i = 0; i < 1000; i++)
     {
         Die die = new Die();
         Console.WriteLine(die.roll().ToString());//outputs 1000 random numbers 
     }
 }
Esempio n. 9
0
        public void move()
        {
            die1.roll();
            die2.roll();
            //move distance is total of both throws
            int iMoveDistance = die1.roll() + die2.roll();

            //increase location
            this.setLocation(this.getLocation() + iMoveDistance);
            this.lastMove = iMoveDistance;

            //2.7 Extend use of Delegates and Events by adding at least two new Events to the game.
            this.luckyDiceEvent(this, new EventArgs());
            this.doubleDiceEvent(this, new EventArgs());

            //2.6 Demonstrate use of generics in the project
            Board.access().record(die1.numberLastRolled(), die2.numberLastRolled(), this.sName);
            Console.WriteLine("The player has moved the sum steps: " + Board.access().showStep(this.sName));
        }
Esempio n. 10
0
        public void testRandomness3Fail1in6()
        {
            //Test randomness that should fail on average 1 in 6 times
            Die die = new Die();

            int numberToTest = 3;
            int roll         = die.roll();

            Assert.AreNotEqual(roll, numberToTest);
            numberToTest = roll;
        }
Esempio n. 11
0
        public void TestDieRollOneThousandRange()
        {
            Die die = new Die();

            for (int i = 0; i < 1000; i++)
            {
                int roll = die.roll();
                Assert.LessOrEqual(roll, 6);
                Assert.GreaterOrEqual(roll, 1);
            }
        }
Esempio n. 12
0
        public void TestDieRollOneThousandRange()
        {
            Die die = new Die();
            for (int i = 0; i < 1000; i++)
            {

                int roll = die.roll();
                Assert.LessOrEqual(roll, 6);
                Assert.GreaterOrEqual(roll, 1);
            }
        }
Esempio n. 13
0
        public void move()
        {
            //string recievedCard;
            int firstDice  = die1.roll();
            int secondDice = die2.roll();
            //move distance is total of both throws
            int iMoveDistance = die1.roll() + die2.roll();

            //increase location
            this.setLocation(this.getLocation() + iMoveDistance);
            this.lastMove = iMoveDistance;


            ////if(recievedCard == card.communityChestCardArray[0] || recievedCard == card.communityChestCardArray[5]
            ////    || firstDice == secondDice)
            ////{
            ////    Console.WriteLine(recievedCard.ToString());
            ////    setLocation(50);

            //}
        }