示例#1
0
 public static void playerBet(ModelContext model, PlayerEntity player, BetCommandType betCommand, long chips)
 {
     if (betCommand == BetCommandType.ALL_IN)
     {
         model.setPlayersAllIn(model.getPlayersAllIn() + 1);
         model.setActivePlayers(model.getActivePlayers() - 1);
     }
     else if (betCommand == BetCommandType.FOLD ||
              betCommand == BetCommandType.TIMEOUT)
     {
         model.setActivePlayers(model.getActivePlayers() - 1);
     }
     playerBet(player, chips);
     model.setHighBet(Math.Max(model.getHighBet(), player.getBet()));
     model.setBets(model.getBets() + 1);
 }
示例#2
0
        public bool execute(ModelContext model)
        {
            bool         result     = false;
            int          playerTurn = model.getPlayerTurn();
            PlayerEntity player     = model.getPlayer(playerTurn);
            BetCommand   command    = player.getBetCommand();

            if (command != null)
            {
                BetCommand resultCommand = command;
                player.setBetCommand(null);
                long           betChips    = 0;
                BetCommandType commandType = command.getType();
                if (CHECKERS[commandType](model, player, command))
                {
                    betChips = command.getChips();
                    player.setState(TexasHoldEmUtil.convert(command.getType()));
                }
                else
                {
                    commandType = BetCommandType.FOLD;
                    player.setState(PlayerState.FOLD);
                    if (command.getType() == BetCommandType.TIMEOUT)
                    {
                        resultCommand = new BetCommand(BetCommandType.TIMEOUT);
                    }
                    else
                    {
                        resultCommand = new BetCommand(BetCommandType.ERROR);
                    }
                    ModelUtil.incrementErrors(player, model.getSettings());
                }
                ModelUtil.playerBet(model, player, commandType, betChips);
                model.lastResultCommand(player, resultCommand);
                model.setPlayerTurn(ModelUtil.nextPalyer(model, playerTurn));
                result = true;
            }

            return(result);
        }
示例#3
0
 public BetCommand(BetCommandType type)
 {
     //this(type,0);
 }
示例#4
0
 public static PlayerState convert(BetCommandType betCommand)
 {
     return(PLAYER_STATE_CONVERSOR[betCommand]);
 }
示例#5
0
 public BetCommand(BetCommandType type, long chips)
 {
     this.type  = type;
     this.chips = chips;
 }