Пример #1
0
  @SuppressWarnings("unchecked")
  private void initAi(AbstractAI bot) {
    AiProvider provider = (AiProvider) bot;
    String aiClass = provider.getPokerAi();
    try {
      Class<PokerAI> forName = (Class<PokerAI>) Class.forName(aiClass);
      ai = forName.newInstance();
    } catch (Exception e) {
      bot.getBot()
          .logWarn(
              "Could not create AI class: "
                  + aiClass
                  + ". Will use Random AI instead. Error: "
                  + e);
      ai = new RandomAI();
    }

    ai.setBot(bot);
  }
Пример #2
0
  public Action onActionRequest(final RequestAction request) {
    if (ai == null) {
      initAi(bot);
    }

    final PerformAction response = ai.onActionRequest(request, state);

    Action action =
        new Action(bot.getBot()) {
          public void run() {
            try {
              bot.getBot().sendGameData(bot.getTable().getId(), bot.getBot().getPid(), response);
            } catch (Throwable th) {
              th.printStackTrace();
            }
          }
        };

    return action;
  }
Пример #3
0
 public void clear() {
   bot.getBot().logDebug("Hand End - Clear poker table state");
   state.clear();
 }