Esempio n. 1
0
        public void AddChips(Player contributedPlayer, decimal chips)
        {
            decimal currentSum = 0;

            if (Contributions.ContainsKey(contributedPlayer))
            {
                currentSum = Contributions[contributedPlayer];
            }
            currentSum += chips;
            TotalChips += chips;
            Contributions.Add(contributedPlayer, currentSum);
        }
Esempio n. 2
0
        public void RemoveChips(Player player, decimal chips)
        {
            if (!Contributions.ContainsKey(player))
            {
                return;
            }
            decimal currentSum = Contributions[player];

            if (chips <= currentSum)
            {
                currentSum -= chips;
                TotalChips -= chips;
                Contributions.Add(player, currentSum);
            }
            else
            {
                // TODO: throw Exception, maybe?
                TotalChips -= currentSum;
                Contributions.Add(player, 0);
            }
        }