Beispiel #1
0
        private void updateOptionButtons()
        {
            currentPlayer = game.handsOfPoker.currentHumanPlayer;
            if (currentPlayer.canCheck(state))
            {
                CheckCallButton.Text = "Check";
                BetRaiseButton.Text = "Bet";
            }
            else
            {
                CheckCallButton.Text = "Call";
                BetRaiseButton.Text = "Raise";
            }

            // updates minimum label
            string newMinBetRaise = "";

            newMinBetRaise = "Minimum: ";
            newMinBetRaise += state.lastRaise > 0 ? state.lastRaise : state.bb;
            if (newMinBetRaise != minBetRaise.Text)
                minBetRaise.Text = newMinBetRaise;
        }
Beispiel #2
0
        public void update()
        {
            if (state.gameOver)
                this.Close();
            else
            {
                potCount.Text = state.potCount.ToString();
                currentPlayer = game.handsOfPoker.currentHumanPlayer;
                foreach (Seat seat in table)
                    seat.refreshPlayer(seat.player, state);

                List<Card> publicCards = state.publicCards;

                if (state.publicCards.Count > 5)
                    throw new System.ArgumentException("Too many public cards.");
                // add public cards to viewer

                string newPublicCardsText = "";
                if (publicCards != null)
                    foreach (Card card in publicCards)
                        newPublicCardsText += " " + card.ToString();

                if (newPublicCardsText != PublicCards.Text)
                    PublicCards.Text = newPublicCardsText; // to stop the flickering, check if they are the same, so as to avoid replacing text.

                updateOptionButtons();

            }
        }
Beispiel #3
0
        public void play(GameState state)
        {
            while (!state.nextToPlay().human && !state.allDoneWithTurn())
            {
                state.nextToPlay().play(state);

                state.updateGameState();
            }

            if (state.allDoneWithTurn() || state.playersInHand() < 2)
                if (progressHand(state.handStep))
                { // progresses hand and returns whether hand is over (the last handStep was river)
                    endHand(state);
                    return;
                }
                else
                    play(state);
            if(!state.gameOver)
            if(state.nextToPlay().human)
                currentHumanPlayer = (HumanPlayer)state.nextToPlay();
        }