Beispiel #1
0
        private Combination DecideCombination(IGame game)
        {
            Combination result = null;

            foreach (Combination c in game.Scoreboard.Combinations)
            {
                if (!c.UsedByPlayer(game.CurrentPlayer))
                {
                    if (result == null)
                    {
                        result = c;
                    }
                    else if (result.CalculateScore(game.Dices) < c.CalculateScore(game.Dices))
                    {
                        result = c;
                    }
                }
            }

            return(result);
        }
Beispiel #2
0
        public void SetCombinationForPlayer(IPlayer player, Combination c, IDices dices)
        {
            if (c.UsedByPlayer(player))
            {
                throw new ArgumentException("Combination already set!");
            }

            c.ApplyCombinationForPlayer(player, dices);
            Console.WriteLine("Player " + player.Name + " applied combination " + c.Name + ", with a score of " + c.CalculateScore(dices) + ".");
            OnCombinationApplied(c);
        }