예제 #1
0
파일: Brain.cs 프로젝트: AzGhort/Farkle
        /// <summary>
        ///     After receiving confirmation from the game, account the last action.
        /// </summary>
        private void AccountLastAction()
        {
            var diceSet = Scoring.DetermineScore(lastKeptDices);

            switch (currentAction)
            {
            case PlayerAction.Score:
                diceSet = Scoring.DetermineScore(lastKeptDices);
                currentTurnState.Score += diceSet.Score;
                totalScore             += currentTurnState.Score;
                break;

            case PlayerAction.Keep:
                diceSet = Scoring.DetermineScore(lastKeptDices);
                currentTurnState.Score += diceSet.Score;
                foreach (var dice in lastKeptDices)
                {
                    dice.Kept = true;
                }
                if (currentTurnState.Dices.TrueForAll(dice => dice.Kept))
                {
                    currentTurnState.ResetDices();
                }
                break;
            }
        }