/// <summary> /// Creates a D and D basic Attribute Rolling set. /// </summary> /// <returns>a DieSet with 3 unmodified 6 sided dice.</returns> public static DiceSet CreateDDStatRoller() { DiceSet dieSet = new DiceSet(); dieSet.Add(new Die()); dieSet.Add(new Die()); dieSet.Add(new Die()); return(dieSet); }
public static void Main(string[] argv) { // You have a `DiceSet` class which has a list for 6 dice // You can roll all of them with roll() // Check the current rolled numbers with getCurrent() // You can reroll with reroll() // Your task is to roll the dice until all of the dice are 6 DiceSet diceSet = new DiceSet(); diceSet.Roll(); diceSet.ShowAll(); diceSet.RollAll6(); diceSet.ShowAll(); }
public static void Main(string[] argv) { // You have a `DiceSet` class which has a list for 6 dice // You can roll all of them with roll() // Check the current rolled numbers with getCurrent() // You can reroll with reroll() // Your task is to roll the dice until all of the dice are 6 // Create dice set // Roll Dices // Show Dices to check // Reroll to get all 6 // Show Dices again DiceSet diceSet = new DiceSet(); diceSet.RollAll(); diceSet.ShowAll(); diceSet.RerollAllNon6(); // RerollAll(); diceSet.ShowAll(); }
public void TestDieSetRollDiceIndividually() { // create dice and set Die d1 = new Die(); Die d2 = new Die(); Die d3 = new Die(); DiceSet set = new DiceSet(); set.Add(d1); set.Add(d2); set.Add(d3); // roll dice individually d1.Roll(); d2.Roll(); d3.Roll(); // add rolls of dice int total = d1.RollResult + d2.RollResult + d3.RollResult; // test that the set roll matches the individual dice Assert.AreEqual<int>(total, set.RollResult, "Dieset roll does not match total value of individually rolled dice."); }
public void TestDDStatRollerAllValuesCheck() { IRollable d = new DiceSet(); IRollable dd1 = DiceFactory.CreateDDStatRoller(); ((DiceSet)d).Add(dd1); // populate "not yet found" list List<int> notFound = new List<int>(); notFound.AddRange(new int[] { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }); // attempt to find each value for (int i = 1; i < 1000; i++) { // arbitrary limit of 10000 maximum tries int result = d.Roll(); // 3 to 18 notFound.Remove(result); if (notFound.Count <= 0) { break; // all found } } // test Assert.AreEqual<int>(0, notFound.Count, "Some values were not rolled on 3 d6."); }
/// <summary> /// Creates a D and D basic Attribute Rolling set. /// </summary> /// <returns>a DieSet with 3 unmodified 6 sided dice.</returns> public static DiceSet CreateDDStatRoller() { DiceSet dieSet = new DiceSet(); dieSet.Add(new Die()); dieSet.Add(new Die()); dieSet.Add(new Die()); return dieSet; }