Exemplo n.º 1
0
 private Action raise(int amount) {
   if (canRaise)
     return ActionUtils.raise(
         HelperUtils.minMax(amount, raiseAction.getMin(), raiseAction.getMax()));
   else if (canCall) return call();
   else return fold();
 }
Exemplo n.º 2
0
  public Action act() {

    reset();

    for (LegalAction legalAction : legalActions) {
      if (legalAction.getType().equalsIgnoreCase("RAISE")) {
        raiseAction = legalAction;
        canRaise = true;
      } else if (legalAction.getType().equalsIgnoreCase("BET")) {
        betAction = legalAction;
        canBet = true;
      } else if (legalAction.getType().equalsIgnoreCase("CHECK")) {
        canCheck = true;
      } else if (legalAction.getType().equalsIgnoreCase("CALL")) {
        canCall = true;
      } else if (legalAction.getType().equalsIgnoreCase("DISCARD")) {
        canDiscard = true;
        if (chosenDiscardCard == null) chooseDiscardCard();
        return discardCard();
      }
    }

    for (PerformedAction performedAction : lastActions) {
      if (performedAction.getType().equalsIgnoreCase("DEAL")) {
        ec.setBoard(board);
        if (performedAction.getStreet().equalsIgnoreCase("FLOP")) {
          chooseDiscardCard(); // this will also update equity
        } else {
          equity = ec.calculateTotalEquity();
        }
      } else if (performedAction.getType().equalsIgnoreCase("POST")
          && performedAction.getActor().equalsIgnoreCase(maj.myName)) {
        equity = ec.calculateTotalEquity();
      }
    }

    maj.update(lastActions);
    dory.update();

    if (board[2] == null) return actPreFlop();
    else if (board[3] == null) {
      return actPostFlop();
    } else if (board[4] == null) return actPostTurn();
    else return actPostRiver();
  }
Exemplo n.º 3
0
 private Action betMin() {
   return bet(betAction.getMin());
 }
Exemplo n.º 4
0
 private Action betAllinMinusOne() {
   return bet(betAction.getMax() - 1);
 }
Exemplo n.º 5
0
 private Action betAllin() {
   return bet(betAction.getMax());
 }
Exemplo n.º 6
0
 //////////////
 /////// BETTING
 //////////////
 private Action bet(int amount) {
   if (canBet)
     return ActionUtils.bet(HelperUtils.minMax(amount, betAction.getMin(), betAction.getMax()));
   else if (canCall) return call();
   else return fold();
 }
Exemplo n.º 7
0
 private Action raiseMin() {
   return raise(raiseAction.getMin());
 }
Exemplo n.º 8
0
 private Action raiseAllinMinusOne() {
   return raise(raiseAction.getMax());
 }
Exemplo n.º 9
0
 private Action raiseAllin() {
   return raise(raiseAction.getMax());
 }