Example #1
0
    private Node(
        AbstractAction prevAct,
        ActionState state,
        Round prevRound,
        List<AbstractAction> path,
        PathToFlop pathToFlop) {
      if (pathToFlop != null) {
        PATH = pathToFlop;
      } else {
        if (prevAct != null) {
          path.add(prevAct);
        }
        PATH = PathToFlop.matching(path);
      }

      // nextIntent

      INDEX = nextIndex++;
      ID = nextId(PATH, state.round());
      INTENT = nextIntent(prevRound);
      CAN_RAISE = state.canRaise();
      CAN_CHECK = state.canCheck();
      STATUS = state.headsUpStatus();
      ROUND = state.round();
      STAKES = state.stakes().smallBlinds();
      DEALER_COMMIT = state.seat(1).commitment().smallBlinds();
      DEALEE_COMMIT = state.seat(0).commitment().smallBlinds();
      DEALER_NEXT = state.dealerIsNext();
      STATE = state;

      KIDS = new EnumMap<>(AbstractAction.class);
      for (Map.Entry<AbstractAction, ActionState> act : state.actions(false).entrySet())
      //                    state.viableActions().entrySet())
      {
        List<AbstractAction> nextPath = (PATH == null) ? new ArrayList<>(path) : null;

        //                if (! act.getValue().atEndOfHand()) {
        KIDS.put(act.getKey(), new Node(act.getKey(), act.getValue(), ROUND, nextPath, PATH));
        //                }
      }

      // intents
      F_INTENT = intent(AbstractAction.QUIT_FOLD);
      C_INTENT = intent(AbstractAction.CHECK_CALL);
      R_INTENT = intent(AbstractAction.BET_RAISE);

      KID_NODES =
          new Node[] {
            KIDS.get(AbstractAction.QUIT_FOLD),
            KIDS.get(AbstractAction.CHECK_CALL),
            KIDS.get(AbstractAction.BET_RAISE)
          };
    }
Example #2
0
  public BasicActionView(ActionState state) {
    round = state.round();
    nextToAct = state.nextToActIndex();

    callPrice = (double) state.toCall().smallBlinds() / state.stakes().smallBlinds();

    if (state.canRaise()) {
      raisePrice = (double) state.betSize().bigBlinds() / state.stakes().smallBlinds();
    } else {
      raisePrice = -1;
    }

    //        this.state = state;
  }