Exemplo n.º 1
0
        // where 'response.amount' is 'toCall' (allows easy 'removeFromStack')
        private void Call(object e)
        {
            Street      s         = this.awaitingActionArgs.gameState.street;
            double      betToCall = this.awaitingActionArgs.potState.toCall;
            BetResponse response  = removeFromStack(betToCall);
            Action      a         = new Call(this, response.amount, s);

            OnPlayerAction(new ReceivedActionEventArgs(a));
        }
Exemplo n.º 2
0
        private void Raise(object e)
        {
            Street      s          = this.awaitingActionArgs.gameState.street;
            double      amountOwed = BetAmount - this.awaitingActionArgs.potState.playerContribution;
            BetResponse res        = removeFromStack(amountOwed);
            Action      a          = new Raise(this, res.amount, s);

            OnPlayerAction(new ReceivedActionEventArgs(a));
        }
Exemplo n.º 3
0
 public List <Player> postAnte(List <Player> activePlayers, Pot pot)
 {
     foreach (Player p in activePlayers)
     {
         BetResponse res = p.removeFromStack(this.ante);
         if (res.complete)
         {
             Action a = new PostAnte(p, res.amount);
             pot.handleAction(a);
         }
         else
         {
             activePlayers.Remove(p);
         }
     }
     return(activePlayers);
 }
Exemplo n.º 4
0
        public List <Player> postSB(List <Player> activePlayers, Pot pot)
        {
            Player      sb  = this.sb.player;
            BetResponse res = sb.removeFromStack(this.smallBlind);

            if (res.complete)
            {
                Action a = new PostSB(sb, res.amount);
                pot.handleAction(a);
            }
            else
            {
                activePlayers.Remove(sb);
                this.rotatePlayers();
                return(this.postSB(activePlayers, pot));
            }
            return(activePlayers);
        }
Exemplo n.º 5
0
        ///// POSTING BLINDS /////

        public List <Player> postBB(List <Player> activePlayers, Pot pot)
        {
            Player      bb  = this.bb.player;
            BetResponse res = bb.removeFromStack(this.bigBlind);

            if (res.complete)
            {
                Action a = new PostBB(bb, res.amount);
                pot.handleAction(a);
            }
            else
            {
                activePlayers.Remove(bb);
                this.bb = table.getNearestLeftSeatWithActivePlayer(this.bb);
                this.fp = table.getNearestLeftSeatWithActivePlayer(this.fp);
                return(this.postBB(activePlayers, pot));
            }
            return(activePlayers);
        }
Exemplo n.º 6
0
        public BetResponse removeFromStack(double amount)
        {
            BetResponse br;

            if (stack > amount)
            {
                Stack -= amount;
                br     = new BetResponse(amount, true);
            }
            else if (stack < amount && stack > 0)
            {
                double temp = stack;
                Stack  = 0;
                Status = PlayerStatus.ALL_IN;
                br     = new BetResponse(temp, true);
            }
            else
            {
                Status = PlayerStatus.SITTING_OUT;
                br     = new BetResponse(0, false);
            }

            return(br);
        }