Esempio n. 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)
          };
    }
Esempio n. 2
0
 public static char nodeCount(PathToFlop path, Round round) {
   return nextId[path.ordinal()][round.ordinal() - 1];
 }
Esempio n. 3
0
 private static char nextId(PathToFlop path, Round round) {
   if (path == null) return nextPreflopId++;
   if (round == null) return nextPostflopTerminalId++;
   return nextId[path.ordinal()][round.ordinal() - 1]++;
 }