Exemple #1
0
        public void newHand(GameState state)
        {
            this.state = state;
            state.handStep = GameState.HandStep.PreFlop;
            Deck deck = new Deck();
            state.deck = deck;
            state.players = state.players;
            this.buttonPos = state.buttonPos;

            if (state.players.Count > 2)
            {
                state.actionPos = (state.buttonPos + 3) % state.players.Count;
                // small blind
                state.players[(buttonPos + 1) % state.players.Count].commitChips(state.bb / 2);
                // big blind
                state.players[(buttonPos + 2) % state.players.Count].commitChips(state.bb);
            }
            else
            {
                state.actionPos = (state.buttonPos) % state.players.Count;
                // small blind
                state.players[(state.buttonPos) % state.players.Count].commitChips(state.bb / 2);
                // big blind
                state.players[(state.buttonPos + 1) % state.players.Count].commitChips(state.bb);
            }

            foreach (Player player in state.players)
            {
                player.inHand = true;
                player.addHoleCards(deck.giveCard(), deck.giveCard());
            }
            state.updateMaxCommitted();

            play(state);
        }