public void TestOnePairMoreThan2()
 {
     DieSet die = new DieSet(6, 6, 5, 6, 6);
     ScoringCategory onePair = new OnePairCategory();
     int score = onePair.CalculateScoreForRoll(die.getCount());
     Assert.AreEqual(12, score);
 }
 public void TestLittleStraightNoScore()
 {
     DieSet die = new DieSet(6, 2, 3, 4, 5);
     ScoringCategory littleStraight = new LittleStraightCategory();
     int score = littleStraight.CalculateScoreForRoll(die.getCount());
     Assert.AreEqual(0, score);
 }
 public void TestFourOfAKindAltNoScore()
 {
     DieSet die = new DieSet(1, 2, 3, 4, 5);
     ScoringCategory fourKindAlt = new FourOfAKindAltCategory();
     int score = fourKindAlt.CalculateScoreForRoll(die.getCount());
     Assert.IsTrue(score == 0);
 }
예제 #4
0
 public void TestFivesSomeFives()
 {
     DieSet dieSet = new DieSet(1, 2, 3, 4, 5);
     ScoringCategory fives = new UpperCategory("Fives", 5);
     int score = fives.CalculateScoreForRoll(dieSet.getCount());
     Assert.IsTrue(score == 5);
 }
 public void TestLittleStraight()
 {
     DieSet die = new DieSet(1, 4, 3, 2, 5);
     ScoringCategory littleStraight = new LittleStraightCategory();
     int score = littleStraight.CalculateScoreForRoll(die.getCount());
     Assert.IsTrue(score == 30);
 }
예제 #6
0
 public void TestOnesSomeOnes()
 {
     DieSet dieSet = new DieSet(1, 1, 2, 3, 1);
     ScoringCategory ones = new UpperCategory("Ones", 1);
     int score = ones.CalculateScoreForRoll(dieSet.getCount());
     Assert.IsTrue(score == 3);
 }
 public void TestFullHouseAltJoker()
 {
     DieSet die = new DieSet(1, 1, 1, 1, 1);
     ScoringCategory fullHouseAlt = new FullHouseAltCategory();
     int score = fullHouseAlt.CalculateScoreForRoll(die.getCount(), true);
     Assert.IsTrue(score == 5);
 }
예제 #8
0
 public void TestFoursSomeFours()
 {
     DieSet dieSet = new DieSet(4, 1, 2, 3, 4);
     ScoringCategory fours = new UpperCategory("Fours", 4);
     int score = fours.CalculateScoreForRoll(dieSet.getCount());
     Assert.IsTrue(score == 8);
 }
예제 #9
0
 public void TestTwosNoTwo()
 {
     DieSet dieSet = new DieSet(1, 3, 4, 5, 6);
     ScoringCategory twos = new UpperCategory("Twos", 2);
     int score = twos.CalculateScoreForRoll(dieSet.getCount());
     Assert.IsTrue(score == 0);
 }
 public void TestFourOfAKind()
 {
     DieSet die = new DieSet(3, 3, 3, 3, 1);
     ScoringCategory fourKind = new FourOfAKindCategory();
     int score = fourKind.CalculateScoreForRoll(die.getCount());
     Assert.IsTrue(score == 13);
 }
예제 #11
0
 public void TestSixesSomeSixes()
 {
     DieSet dieSet = new DieSet(1, 2, 5, 6, 6);
     ScoringCategory sixes = new UpperCategory("Sixes", 6);
     int score = sixes.CalculateScoreForRoll(dieSet.getCount());
     Assert.IsTrue(score == 12);
 }
예제 #12
0
 public void TestOnePair_MultiUseCategory_ThrowsException()
 {
     DieSet dieSet = new DieSet(1, 1, 2, 3, 1);
     ScoringCategory onePair = new OnePairCategory();
     int score = onePair.Score(dieSet.getCount());
     score = onePair.Score(dieSet.getCount());
 }
예제 #13
0
 public void TestOnePairUseHighestPair()
 {
     DieSet die = new DieSet(3, 3, 4, 4, 5);
     ScoringCategory onePair = new OnePairCategory();
     int score = onePair.CalculateScoreForRoll(die.getCount());
     Assert.AreEqual(8, score);
 }
예제 #14
0
 public void TestOnePairNoScore()
 {
     DieSet die = new DieSet(1, 2, 3, 4, 5);
     ScoringCategory onePair = new OnePairCategory();
     int score = onePair.CalculateScoreForRoll(die.getCount());
     Assert.IsTrue(score == 0);
 }
 public void TestThreeofAKindAltMore()
 {
     DieSet die = new DieSet(6, 6, 6, 6, 6);
     ScoringCategory threeKindAlt = new ThreeOfAKindAltCategory();
     int score = threeKindAlt.CalculateScoreForRoll(die.getCount());
     Assert.AreEqual(18, score);
 }
예제 #16
0
 public void TestTwosSomeTwos()
 {
     DieSet dieSet = new DieSet(1, 1, 2, 2, 3);
     ScoringCategory twos = new UpperCategory("Twos", 2);
     int score = twos.CalculateScoreForRoll(dieSet.getCount());
     Assert.IsTrue(score == 4);
 }
 public void TestLargeStraightNoScore()
 {
     DieSet die = new DieSet(1, 2, 3, 4, 6);
     ScoringCategory largeStraight = new LargeStraightCategory();
     int score = largeStraight.CalculateScoreForRoll(die.getCount());
     Assert.IsTrue(score == 0);
 }
예제 #18
0
 public void TestTwos_MultiUseCategory_ThrowsException()
 {
     DieSet dieSet = new DieSet(1, 1, 2, 3, 1);
     ScoringCategory twos = new UpperCategory("Twos", 2);
     int score = twos.Score(dieSet.getCount());
     score = twos.Score(dieSet.getCount());
 }
 public void TestFullHouseNoScore()
 {
     DieSet die = new DieSet(1, 2, 3, 4, 5);
     ScoringCategory fullHouse = new FullHouseCategory();
     int score = fullHouse.CalculateScoreForRoll(die.getCount());
     Assert.IsTrue(score == 0);
 }
예제 #20
0
        public override int CalculateScoreForRoll(DieSet dieSet)
        {
            //throw new NotImplementedException();
            int score = 0;
            getCount(dieSet);
            bool isGood = false;

            // check to see if there's one number that has a count of at least 4
            for (int i = 1; i <= 6; i++)
            {
                if (count[i] >= 4)
                {
                    isGood = true;
                }
            }

            // if this is a valid 4 of a kind, the score is the total value of the dice, 0 otherwise
            if (isGood){
                foreach (Die die in dieSet.Dice)
                {
                    score += die.Value;
                }
            }

            return score;
        }
 public void TestFullHouseAlt_MultiUseCategory_ThrowsException()
 {
     DieSet dieSet = new DieSet(1, 1, 2, 3, 1);
     ScoringCategory fullHouseAlt = new FullHouseAltCategory();
     int score = fullHouseAlt.Score(dieSet.getCount());
     score = fullHouseAlt.Score(dieSet.getCount());
 }
 public void TestLargeStraightAlt()
 {
     DieSet die = new DieSet(3, 2, 6, 5, 4);
     ScoringCategory largeStraightAlt = new LargeStraightAltCategory();
     int score = largeStraightAlt.CalculateScoreForRoll(die.getCount());
     Assert.IsTrue(score == 20);
 }
예제 #23
0
 public void TestFives_MultiUseCategory_ThrowsException()
 {
     DieSet dieSet = new DieSet(1, 1, 2, 3, 1);
     ScoringCategory fives = new UpperCategory("Fives", 5);
     int score = fives.Score(dieSet.getCount());
     score = fives.Score(dieSet.getCount());
 }
 public void TestLargeStraightAltJoker()
 {
     DieSet dieSet = new DieSet(5, 5, 5, 5, 5);
     ScoringCategory largeStraightAlt = new LargeStraightAltCategory();
     int score = largeStraightAlt.Score(dieSet.getCount(), true);
     Assert.AreEqual(20, score);
 }
 public void TestLittleStraightJoker()
 {
     DieSet dieSet = new DieSet(1, 1, 1, 1, 1);
     ScoringCategory littleStraight = new LittleStraightCategory();
     int score = littleStraight.Score(dieSet.getCount(), true);
     Assert.AreEqual(30, score);
 }
예제 #26
0
        public override void reroll(DieSet dieSet, int rerollsLeft, ScoreSheet scoreSheet)
        {
            calcFinalDice(scoreSheet);
            rerollOptions = new Hashtable();
            calcReroll(2, finalDice);
            diceOptionsScores = new Hashtable();
            diceOptionsReroll = new Hashtable();
            calcDiceOptions(2, (Hashtable)rerollOptions[2]);

            string dice = "";
            foreach (Die die in dieSet.Dice)
                dice += die.Value.ToString();
            dice = resortDice(dice);
            string rerollChoice;

            if (rerollsLeft == 2)
            {
                calcReroll(1, (Hashtable)diceOptionsScores[2]);
                calcDiceOptions(1, (Hashtable)rerollOptions[1]);
                rerollChoice = (String)((Hashtable)diceOptionsReroll[1])[dice];
            }
            else
                rerollChoice = (String)((Hashtable)diceOptionsReroll[2])[dice];

            int[] count = convertToCount(rerollChoice);
            freezeDice(dieSet, count);
        }
 public void TestLittleStraight_MultiUseCategory_ThrowsException()
 {
     DieSet dieSet = new DieSet(1, 1, 2, 3, 1);
     ScoringCategory littleStraight = new LittleStraightCategory();
     int score = littleStraight.Score(dieSet.getCount());
     score = littleStraight.Score(dieSet.getCount());
 }
 public void TestThreeOfAKindAlt()
 {
     DieSet die = new DieSet(6, 6, 6, 1, 2);
     ScoringCategory threeKindAlt = new ThreeOfAKindAltCategory();
     int score = threeKindAlt.CalculateScoreForRoll(die.getCount());
     Assert.IsTrue(score == 18);
 }
 public void TestFourOfAKindAlt_MultiUseCategory_ThrowsException()
 {
     DieSet dieSet = new DieSet(1, 1, 2, 3, 1);
     ScoringCategory fourKindAlt = new FourOfAKindAltCategory();
     int score = fourKindAlt.Score(dieSet.getCount());
     score = fourKindAlt.Score(dieSet.getCount());
 }
예제 #30
0
 public void TestOnePair()
 {
     DieSet die = new DieSet(6, 6, 5, 1, 2);
     ScoringCategory onePair = new OnePairCategory();
     int score = onePair.CalculateScoreForRoll(die.getCount());
     Assert.IsTrue(score == 12);
 }