示例#1
0
        private void payWinner(List <int> winnrs)
        {
            Debug.WriteLine($"Pot ${pot}");
            foreach (var winner in winnrs)
            {
                if (winner == 0 && winnrs.Count == 1) //'dealer' is always 0
                {
                    setInfo(gameInfo, "Dealer Wins");
                    Debug.WriteLine("Dealer Wins");
                }
                else if (winnrs.Count == 1)
                {
                    setInfo(gameInfo, $"Computer{winner} Wins");
                    Debug.WriteLine($"Computer{winner} Wins");
                }
                else
                {
                    Debug.WriteLine($"Player{winner} Wins {pot / winnrs.Count}");
                }
                round.money[winner] += pot / winnrs.Count;
            }

            if (winnrs.Count != 1)
            {
                setInfo(gameInfo, "Split Pot");
                Debug.WriteLine("Split Pot");
            }

            pot = 0;
            setInfo(potMoney, $"Pot: ${pot}");
            setInfo(dealerMoney, $"Bank: ${round.money[0]}");
            round.Done();
            updateTelemetry();

            busy = false;
            if (autopilot)
            {
                Debug.WriteLine("Autopilot Disabled");
            }
            autopilot = false;
        }
示例#2
0
        private void Clean(bool all)
        {
            if (all)
            {
                RandomGen rand = new RandomGen();
                round = new PokerRound(rand, 2);
                round.Done();
                round.money.Add(startMoney);
                round.money.Add(startMoney);
                pot = 0;
                foreach (var card in table)
                {
                    card.Image = null;
                }
                cardOne.Image = null;
                cardTwo.Image = null;

                dealerInfo.Visible  = false;
                debug.Visible       = false;
                potMoney.Visible    = false;
                playerCount.Visible = false;
                betButton.Text      = $"Bet ${bet}";
                busy      = false;
                autopilot = false;
            }
            else
            {
                turn.Image       = null;
                river.Image      = null;
                potMoney.Visible = true;
            }
            foreach (var card in table)
            {
                setBorder(card, BorderStyle.None);
            }
            setBorder(cardOne, BorderStyle.None);
            setBorder(cardTwo, BorderStyle.None);
            dealerMoney.Text = $"Bank: ${round.money[0]}";
            gameInfo.Text    = all ? "Welcome" : gameInfo.Text;
        }