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; }
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); }
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 } }
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; }
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)); }
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; }
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); } }
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); //} }