예제 #1
0
        private static int calcDiceSum(DiceSet set)
        {
            int score = 0;

            foreach (GameDie die in set)
            {
                score += die.Number;
            }


            return(score);
        }
예제 #2
0
        private static int calcUpperComboScore(DiceSet set, int face)
        {
            int score = 0;

            foreach (GameDie die in set)
            {
                if (die.Number == face)
                {
                    score += die.Number;
                }
            }


            return(score);
        }
예제 #3
0
        public void UseScore(ScoreSlot slot, DiceSet set)
        {
            if (slot == SLOT_YAHTZEE)
            {
            }                             //Add bonus here

            if (!slot.Score.HasValue)
            {
                if (slot.Qualifier(set))
                {
                    slot.Score = slot.ScorePotential(set);
                }
                else
                {
                    slot.Score = 0;
                }
            }
        }
예제 #4
0
 public void Reset()
 {
     Throws = 0;
     DiceSet.ResetHeld();
 }
예제 #5
0
 public void UseScore(ScoreSlot slot, DiceSet set)
 {
     ScoreCard.UseScore(slot, set);
     Reset();
 }
예제 #6
0
 public void ThrowDice()
 {
     DiceSet.RollDice();
     Throws += 1;
 }
예제 #7
0
 public PlayerState(DiceSet set, ScoreCard scoreCard)
 {
     this.DiceSet   = set;
     this.ScoreCard = scoreCard;
 }
예제 #8
0
 public YahtzeeGame()
 {
     DiceSet      = new DiceSet(new Random());
     Player1State = new PlayerState(DiceSet, new ScoreCard());
 }