Ejemplo n.º 1
0
 public DieRollResult CountPoints(DiceRoll diceRoll)
 {
     if (IsApplicable(diceRoll))
     {
         return(new DieRollResult(DiceCombination.FiveOfAKind, _points));
     }
     return(DieRollResult.Default());
 }
Ejemplo n.º 2
0
 public DieRollResult CountPoints(DiceRoll diceRoll)
 {
     if (!IsApplicable(diceRoll))
     {
         return(DieRollResult.Default());
     }
     return(Combination(diceRoll));
 }
Ejemplo n.º 3
0
 public DieRollResult CountPoints(DiceRoll diceRoll)
 {
     if (IsApplicable(diceRoll))
     {
         return(new DieRollResult(DiceCombination.FullHouse, _points));
     }
     else
     {
         return(DieRollResult.Default());
     }
 }
Ejemplo n.º 4
0
 public DieRollResult CountPoints(DiceRoll diceRoll)
 {
     if (IsApplicable(diceRoll))
     {
         return(new DieRollResult(DiceCombination.ThreeOfAKind, GetPoints(diceRoll)));
     }
     else
     {
         return(DieRollResult.Default());
     }
 }
Ejemplo n.º 5
0
        public DieRollResult CountPoints(DiceRoll diceRoll)
        {
            var dice = diceRoll.AllDice.ToIntArray().OrderBy(x => x).ToArray();

            if (dice.Distinct().Count() != 5)
            {
                return(DieRollResult.Default());
            }
            else
            {
                if (dice.Any((x => x == (int)DieRoll.One)) && IsSequenceConsecutive(dice))
                {
                    return(new DieRollResult(DiceCombination.StraightLow, _points));
                }
                else if (IsSequenceConsecutive(dice))
                {
                    return(new DieRollResult(DiceCombination.StraightHigh, _points));
                }
                else
                {
                    return(DieRollResult.Default());
                }
            }
        }