Esempio n. 1
0
  private void streetAction(PerformedAction performedAction) {
    myBets += myBetsThisStreet;
    myBetsThisStreet = 0;
    theirBets += theirBetsThisStreet;
    theirBetsThisStreet = 0;

    changeEquity += changeEquityCall;

    changeEquityCall = 0.0;
    changeEquityTemp = 0.0;

    if (performedAction.getStreet().equalsIgnoreCase("FLOP")) {
      currentState = GameState.PRETURN;

      // changeEquity += (maj.getSDWRate() - 0.6) * sdwFactor / 2.0;
    } else if (performedAction.getStreet().equalsIgnoreCase("TURN")) {
      currentState = GameState.PRERIVER;

      changeEquity += (maj.getSDWRate() - 0.6) * sdwFactor / 4.0;
    } else if (performedAction.getStreet().equalsIgnoreCase("RIVER")) {
      currentState = GameState.POSTRIVER;

      changeEquity += (maj.getSDWRate() - 0.6) * sdwFactor / 4.0;
    }
  }
Esempio n. 2
0
  private void theirBetAction(PerformedAction performedAction) {
    theirBetsThisStreet += performedAction.getAmount();

    double potBet =
        (double) performedAction.getAmount() / (brain.potSize - performedAction.getAmount());

    if (potBet < 0.2) return;

    theirRaiseHistory[currentState.ordinal()].add(performedAction.getAmount());

    double PFR = adjustPFR(maj.getPFR());
    double AGGRO = adjustAggro(maj.getAggression());
    double AGGROFREQ = adjustAggroFreq(maj.getAggressionFrequency());

    double logFactor =
        HelperUtils.logisticSmall(3.0, 3.0, potBet)
            * Math.min(
                100.0,
                (HelperUtils.logistic(400.0, 400.0, performedAction.getAmount()) + 300.0) / 4);

    if (currentState == GameState.PREFLOP) {
      changeEquity -= pfRaiseFactor * logFactor / PFR;
    } else {
      changeEquity -= pfRaiseFactor * logFactor / AGGROFREQ;
    }

    changeEquityCall = 0.0;
  }
Esempio n. 3
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();
  }
Esempio n. 4
0
  private void theirRaiseAction(PerformedAction performedAction) {

    double potBet =
        (double) (performedAction.getAmount() - theirBetsThisStreet)
            / (brain.potSize - performedAction.getAmount());
    if (potBet < 0.2) {
      theirBetsThisStreet += performedAction.getAmount();
      return;
    }

    theirRaiseHistory[currentState.ordinal()].add(performedAction.getAmount());

    double PFR = adjustPFR(maj.getPFR());
    double AGGRO = adjustAggro(maj.getAggression());
    double AGGROFREQ = adjustAggroFreq(maj.getAggressionFrequency());

    double logFactor =
        HelperUtils.logisticSmall(3.0, 3.0, potBet)
            * Math.min(
                100.0,
                (HelperUtils.logistic(
                            400.0, 400.0, performedAction.getAmount() - theirBetsThisStreet)
                        + 300.0)
                    / 4);

    double THREEB = maj.get3BetRate();
    double TWOB = maj.get2BetRate();

    if (myRaiseHistory[currentState.ordinal()].size() == 1
        && theirRaiseHistory[currentState.ordinal()].size() == 1) {
      logFactor *=
          1.0
              + (0.2 - TWOB)
                  * Math.min(100.0, myRaiseHistory[currentState.ordinal()].get(0))
                  / 30.0;
    } else if (theirRaiseHistory[currentState.ordinal()].size() == 2) {
      logFactor *= 1.0 + (0.25 - THREEB) * 1.5;
    } else if (theirRaiseHistory[currentState.ordinal()].size() >= 3) {
      logFactor *= 1.0 + (0.25 - THREEB) * 3.0;
    }

    if (currentState == GameState.PREFLOP) {
      changeEquity -= pfRaiseFactor * logFactor / PFR;
    } else {
      changeEquity -= pfRaiseFactor * logFactor / AGGROFREQ;
    }

    changeEquityCall = 0.0;
    theirBetsThisStreet += performedAction.getAmount();
  }
Esempio n. 5
0
  private void myRaiseAction(PerformedAction performedAction) {
    myBetsThisStreet += performedAction.getAmount();

    myRaiseHistory[currentState.ordinal()].add(performedAction.getAmount());
  }
Esempio n. 6
0
 // my actions
 private void myPostAction(PerformedAction performedAction) {
   myBetsThisStreet += performedAction.getAmount();
 }
Esempio n. 7
0
 public void update() {
   for (int i = 0; i < brain.lastActions.length; i++) {
     PerformedAction performedAction = brain.lastActions[i];
     if (performedAction.getType().equalsIgnoreCase("RAISE")) {
       if (performedAction.getActor().equalsIgnoreCase(maj.myName)) myRaiseAction(performedAction);
       else theirRaiseAction(performedAction);
     } else if (performedAction.getType().equalsIgnoreCase("BET")) {
       if (performedAction.getActor().equalsIgnoreCase(maj.myName)) myBetAction(performedAction);
       else theirBetAction(performedAction);
     } else if (performedAction.getType().equalsIgnoreCase("CALL")) {
       if (performedAction.getActor().equalsIgnoreCase(maj.myName)) myCallAction(performedAction);
       else theirCallAction(performedAction);
     } else if (performedAction.getType().equalsIgnoreCase("CHECK")) {
       if (performedAction.getActor().equalsIgnoreCase(maj.myName)) myCheckAction(performedAction);
       else theirCheckAction(performedAction);
     } else if (performedAction.getType().equalsIgnoreCase("POST")) {
       if (performedAction.getActor().equalsIgnoreCase(maj.myName)) myPostAction(performedAction);
       else theirPostAction(performedAction);
     } else if (performedAction.getType().equalsIgnoreCase("DEAL")) {
       streetAction(performedAction);
     }
   }
 }
Esempio n. 8
0
 private void theirPostAction(PerformedAction performedAction) {
   theirBetsThisStreet += performedAction.getAmount();
   changeEquity += (maj.getSDWRate() - 0.6) * sdwFactor;
 }