private void SetItemScoreByType(YatzyScoreType type, int score)
        {
            YatzyItem item = GetItemByType(type);

            if (item != null)
            {
                item.Score = score;
            }
        }
        private int GetItemScoreByType(YatzyScoreType type)
        {
            YatzyItem item = GetItemByType(type);

            if (item != null)
            {
                return(item.Score);
            }
            return(0);
        }
        public YatzyBoard()
        {
            for (int i = 0; i < total_dice; i++)
            {
                _dice[i] = new YatzyDice(random)
                {
                    Index   = i,
                    Command = new CommandHandler((param) => Hold((int)param))
                };
            }
            _items.Clear();
            foreach (YatzyScoreType type in Enum.GetValues(typeof(YatzyScoreType)))
            {
                YatzyItem item = new YatzyItem()
                {
                    Type = type
                };
                switch (item.Type)
                {
                case YatzyScoreType.AcesScore:
                    item.Command = new CommandHandler((p) => AddUpDice(item.Type, 1));
                    break;

                case YatzyScoreType.TwosScore:
                    item.Command = new CommandHandler((p) => AddUpDice(item.Type, 2));
                    break;

                case YatzyScoreType.ThreesScore:
                    item.Command = new CommandHandler((p) => AddUpDice(item.Type, 3));
                    break;

                case YatzyScoreType.FoursScore:
                    item.Command = new CommandHandler((p) => AddUpDice(item.Type, 4));
                    break;

                case YatzyScoreType.FivesScore:
                    item.Command = new CommandHandler((p) => AddUpDice(item.Type, 5));
                    break;

                case YatzyScoreType.SixesScore:
                    item.Command = new CommandHandler((p) => AddUpDice(item.Type, 6));
                    break;

                case YatzyScoreType.ThreeOfAKindScore:
                    item.Command = new CommandHandler((p) => ValueOfAKind(item.Type, 3, "Three"));
                    break;

                case YatzyScoreType.FourOfAKindScore:
                    item.Command = new CommandHandler((p) => ValueOfAKind(item.Type, 4, "Four"));
                    break;

                case YatzyScoreType.FullHouseScore:
                    item.Command = new CommandHandler((p) => ItemScore(item.Type, 25, "Full House"));
                    break;

                case YatzyScoreType.SmallStraightScore:
                    item.Command = new CommandHandler((p) => ItemScore(item.Type, 30, "Small Straight"));
                    break;

                case YatzyScoreType.LargeStraightScore:
                    item.Command = new CommandHandler((p) => ItemScore(item.Type, 40, "Large Straight"));
                    break;

                case YatzyScoreType.YahtzeeScore:
                    item.Command = new CommandHandler((p) => Yahtzee());
                    break;

                case YatzyScoreType.ChanceScore:
                    item.Command = new CommandHandler((p) => Chance());
                    break;

                case YatzyScoreType.YahtzeeBonusScore:
                    item.Command = new CommandHandler((p) => YahtzeeBonus());
                    break;
                }
                _items.Add(item);
            }
        }