Exemplo n.º 1
0
        internal void bet(Slot slot, TexasBetRequest texasBetRequest)
        {
            betInternal(slot, texasBetRequest);
            this.PrevPlayer = slot;
            Log.DebugFormat("DONE BET, PREV PLAYER = " + this.PrevPlayer.UserKey);
            int  slotIndex  = getSlotIndex(slot);
            Slot nextPlayer = getNextPlayer(slotIndex + 1);

            updateTimeForThink(nextPlayer);
            if (nextPlayer == this.Starter)
            {
                calcPot();
                // update state
                this.TableState++;
                // reset new bet
                this.CurrentBet = 0;
                // add to pot on table
                this.ChipPots.Add(this.currentChipPot);
                // create new pot
                this.currentChipPot = new ChipPot();

                // clear new prevPlayer
                this.PrevPlayer = null;
                Log.DebugFormat("Next State: " + this.TableState);
            }
            this.CurrentPlayer = nextPlayer;
            Log.DebugFormat("DONE BET, CURRENT PLAYER = " + this.CurrentPlayer.UserKey);
            if (this.TableState > 6)
            {
                // handle and game
                return;
            }
        }
Exemplo n.º 2
0
        internal void startGame()
        {
            Log.DebugFormat("SETUP START GAME");
            int  currentIndex   = this.DealerIndex;
            Slot smallBlindSlot = getNextPlayer(currentIndex + 1);

            if (smallBlindSlot == null) // no one on table
            {
                return;
            }

            currentIndex = getSlotIndex(smallBlindSlot);
            if (currentIndex < 0)
            {
                return;
            }
            Slot bigBlindSlot = getNextPlayer(currentIndex + 1);

            if (bigBlindSlot == null) // no one on table
            {
                return;
            }

            var texasModel = this.Facade.RetrieveProxy(TexasModel.NAME) as TexasModel;

            // small blind
            smallBlindSlot.CurrentBet     = this.SmallBlindValue;
            smallBlindSlot.CurrentCredit -= this.SmallBlindValue;
            smallBlindSlot.Status         = (int)PlayerStatusCode.SmallBlind;
            this.SmallBlindIndex          = getSlotIndex(smallBlindSlot);

            // big blind
            bigBlindSlot.CurrentBet     = this.SmallBlindValue * 2;
            bigBlindSlot.CurrentCredit -= this.SmallBlindValue * 2;
            bigBlindSlot.Status         = (int)PlayerStatusCode.BigBlind;
            this.BigBlindIndex          = getSlotIndex(bigBlindSlot);

            currentIndex = this.BigBlindIndex;

            // find nextPlayer
            Slot currentPlayer = getNextPlayer(currentIndex + 1);

            this.CurrentPlayer = currentPlayer;
            this.PrevPlayer    = null;
            this.Starter       = currentPlayer;

            this.CurrentBet = this.SmallBlindValue * 2;
            // big blind + small blind
            currentChipPot = new ChipPot();
            currentChipPot.updatePot(SmallBlindValue, smallBlindSlot.UserKey);
            currentChipPot.updatePot(SmallBlindValue * 2, bigBlindSlot.UserKey);

            this.TableState = (int)GameStateCode.PreFlop;

            // set time for think
            updateTimeForThink(currentPlayer);

            for (int index = 0; index < this.Slots.Length; index++)
            {
                Slot slot = this.Slots[index];
                if (slot.isEmpty())
                {
                    continue;
                }
                slot.isOnGame = true;
                slot.isFold   = false;
            }

            this.isPlaying = true;
            Log.DebugFormat("SETUP START GAME DONE");
        }