Пример #1
0
        private int SumOfSameCombo(Combo combo)
        {
            int faceValue = (int)combo + 1;

            int[] diceValue = diceList.GetNumberOfDiceFaceValue();
            return(diceValue[faceValue - 1] * (faceValue));
        }
        private void PlayRound(Player player)
        {
            AI    ai         = player as AI;
            Combo comboToUse = Combo.Chance;

            view.RenderRound(player.Name);
            for (int rollNumber = 1; rollNumber <= 3; rollNumber++)
            {
                if (AnyDiceToRoll())
                {
                    diceList.Roll(DiceToRoll);
                    view.RenderDice(diceList.GetDice());
                    if (rollNumber < 3)
                    {
                        if (player.IsAI)
                        {
                            DiceToRoll = ai.GetDiceToRoll(diceList.GetNumberOfDiceFaceValue(), diceList.GetDice());
                        }
                        else
                        {
                            if (rollNumber == 1)
                            {
                                view.RenderUnavailableCombos(player.GetUsedCombinations());
                            }
                            DiceToRoll = view.GetDiceToRoll();
                        }
                        view.RenderDiceToRoll(DiceToRoll, player.Decision);
                    }
                }
            }
            if (player.IsAI)
            {
                comboToUse = ai.SelectComboToUse();
            }
            else
            {
                comboToUse = view.RenderCombo(player.GetUsedCombinations());
            }
            player.AddScore(comboToUse, rules.CheckCombinations(comboToUse));

            bool exist      = false;
            int  roundScore = player.GetScore(comboToUse, out exist);

            if (exist)
            {
                view.GetRoundScore(roundScore, comboToUse);
            }
        }