Example #1
0
        public void Bid(int userId, int bid)
        {
            // HighStakesHttpClient httpClient = new HighStakesHttpClient();
            // seat = httpClient.RunAsyncForBid(seat, bid).GetAwaiter().GetResult();
            DSeat seat = seatsOrder.FirstOrDefault(o => o.Player.UserId == userId);

            if (bid > seat.ChipTotal)
            {
                seat.RoundBid += seat.ChipTotal;
                seat.ChipTotal = 0;
            }
            else
            {
                seat.RoundBid  += bid;
                seat.ChipTotal -= bid;
            }
        }
Example #2
0
        public bool incrementTurn()
        {
            if (nextTurn < this.NumOfActivePlayers() - 1)
            {
                Console.WriteLine("From Turn true");
                nextTurn++;
                return(true);
            }
            else
            {
                Reorder();
                this.subround++;
                if (this.subround == 4)
                {
                    this.subround = 0;
                    foreach (var seat in seatsOrder)
                    {
                        seat.Active = true;
                        seat.Flop.AddRange(this.table.Flop);

                        DSeat currentSeat = table.Seats.FirstOrDefault(o => o.Player.UserId == seat.Player.UserId);
                        int   index       = table.Seats.IndexOf(currentSeat);
                        table.Seats[index] = seat;

                        currentSeat = table.SeatsInTurnOrder.FirstOrDefault(o => o.Player.UserId == seat.Player.UserId);
                        index       = table.Seats.IndexOf(currentSeat);
                        table.SeatsInTurnOrder[index] = seat;
                    }

                    EndRound();
                    StartRound();
                }
                Console.WriteLine("From Turn false");
                nextTurn = 0;
                return(false);
            }
        }