Exemplo n.º 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);
  }
Exemplo n.º 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;
  }
Exemplo n.º 3
0
 public void clear() {
   bot.getBot().logDebug("Hand End - Clear poker table state");
   state.clear();
 }