示例#1
0
            public override void Exec(Table table)
            {
                var finalizedPots = new List<Pot>();
                var finalizedPotsSbs = new List<Pot>();
                foreach (var pot in table.Pots)
                {
                    var findPot = finalizedPots.FirstOrDefault(o => pot.Players.Where(player => player.IsInPlay).All(player => o.Players.Contains(player)) && o.Players.Count == pot.Players.Count(player => player.IsInPlay));
                    var findPotSbs = finalizedPotsSbs.FirstOrDefault(o => pot.Players.Where(player => player.IsInPlay).All(player => o.Players.Contains(player)) && o.Players.Count == pot.Players.Count(player => player.IsInPlay) && o.Street == pot.Street);
                    if (findPot == null)
                    {
                        findPot = new Pot(pot.Players.Where(player => player.IsInPlay).ToList(), 0, Street.Unknown);
                        finalizedPots.Add(findPot);
                    }
                    if (findPotSbs == null)
                    {
                        findPotSbs = new Pot(pot.Players.Where(player => player.IsInPlay).ToList(), 0, pot.Street);
                        finalizedPotsSbs.Add(findPotSbs);
                    }
                    findPot.Amount += pot.Amount;
                    findPotSbs.Amount += pot.Amount;
                }

                Pots = table.Pots;
                PotsStreetByStreet = table.PotsStreetByStreet;
                table.Pots = finalizedPots;
                table.PotsStreetByStreet = finalizedPotsSbs;
                table.TotalPotBeforeCollection = Pots.Sum(o => o.Amount);
            }
示例#2
0
            public override void Exec(Table table)
            {
                while (table.Players.Any(o => o.Bet != 0))
                {
                    decimal amount = 0;
                    decimal bet = table.Players.Where(p => p.Bet > 0).Min(p => p.Bet);
                    var players = new List<Player>();
                    foreach (var player in table.Players)
                    {
                        if (player.Bet >= bet)
                        {
                            player.Bet -= bet;
                            amount += bet;
                            players.Add(player);
                        }
                    }
                    var pot = new Pot(players, amount, Street);
                    Pots.Add(pot);
                }

                table.Pots.AddRange(Pots);
            }