private void  TestUpperSectionSingle(DiceSet set, ScoreSlot slot, int digit)
 {
     {
         int expected = 4 * digit;
         set[0].Number = digit;
         set[1].Number = digit;
         set[2].Number = digit;
         set[3].Number = digit;
         set[4].Number = 0;
         int actual = slot.ScorePotential(set);
         Assert.AreEqual(expected, actual, "Failed upper test for " + digit);
     }
 }
        private void updateScoreSlot(String labelPrefix, Label scoreLabel, Button scoreButton, ScoreSlot slot, PlayerState state)
        {
            if (slot.Score.HasValue)
            {
                scoreLabel.Content     = labelPrefix + ": " + slot.Score.Value;
                scoreButton.Visibility = Visibility.Hidden;
            }
            else
            {
                scoreLabel.Content = labelPrefix;
                if (state.CanScore())
                {
                    int potential = 0;
                    scoreButton.Visibility = Visibility.Visible;

                    if (slot.Qualifier(state.DiceSet))
                    {
                        potential = slot.ScorePotential(state.DiceSet);
                    }
                    else
                    {
                        potential = 0;
                    }


                    scoreButton.Content = $"+{potential}";
                }
                else
                {
                    scoreButton.Visibility = Visibility.Hidden;
                }
            }
        }
        private void ScoreSlot_Click(object sender, RoutedEventArgs e)
        {
            PlayerState playerState = yahtzeeGame.Player1State;
            ScoreCard   scoreCard   = yahtzeeGame.Player1State.ScoreCard;

            ScoreSlot slot = null;

            if (ScoreOnesButton == sender)
            {
                slot = scoreCard.SLOT_ONES;
            }
            else if (ScoreTwosButton == sender)
            {
                slot = scoreCard.SLOT_TWOS;
            }
            else if (ScoreThreesButton == sender)
            {
                slot = scoreCard.SLOT_THREES;
            }
            else if (ScoreFoursButton == sender)
            {
                slot = scoreCard.SLOT_FOURS;
            }
            else if (ScoreFivesButton == sender)
            {
                slot = scoreCard.SLOT_FIVES;
            }
            else if (ScoreSixesButton == sender)
            {
                slot = scoreCard.SLOT_SIXES;
            }
            else if (ScoreThreeKindButton == sender)
            {
                slot = scoreCard.SLOT_THREE_OF_KIND;
            }
            else if (ScoreFourKindButton == sender)
            {
                slot = scoreCard.SLOT_FOUR_OF_KIND;
            }
            else if (ScoreFullHouseButton == sender)
            {
                slot = scoreCard.SLOT_FULL_HOUSE;
            }
            else if (ScoreSmallStrButton == sender)
            {
                slot = scoreCard.SLOT_SMALL_STRAIGHT;
            }
            else if (ScoreLargeStrButton == sender)
            {
                slot = scoreCard.SLOT_LARGE_STRAIGHT;
            }
            else if (ScoreChanceButton == sender)
            {
                slot = scoreCard.SLOT_CHANCE;
            }
            else if (ScoreYahtzeeButton == sender)
            {
                slot = scoreCard.SLOT_YAHTZEE;
            }


            playerState.UseScore(slot, playerState.DiceSet);
            updateDisplay();
        }