コード例 #1
0
  @Override
  public List<HearthActionBoardPair> playTurn(
      int turn, BoardModel board, BoardStateFactoryBase factory) throws HSException {
    /*
       The moves that are provided will consist of Play card, for every card possible to play and for every position the card can be played onto the board,
       hold card that is a flag that keeps all cards in the hand this turn, Attack, and DoNotAttack which will stop the minions from being used later the same turn.

        proposed strategy will be to weight the choices, fit it so end turn will happen less without actually doing moves, specifically hold card, and dont attack
        should be unlikely actions, before stuff is done.

    */
    ArrayList<HearthActionBoardPair> returnList = new ArrayList<HearthActionBoardPair>();
    ArrayList<HearthTreeNode> tempList = new ArrayList<HearthTreeNode>();
    boolean notESelected = true;
    CustomChildNodeCreator childNodeCreator = CustomChildNodeCreator.getInstance();
    while (notESelected) {
      tempList = childNodeCreator.createChildren(new HearthTreeNode((board)));

      double i = Math.random();
      if (i < 0.01 || tempList.isEmpty()) {
        notESelected = false;
      } else {
        removeUnwantedChildren(tempList);
        i = Math.random() * tempList.size();
        i = Math.floor(i);
        board = tempList.get((int) i).data_.deepCopy();
        returnList.add(new HearthActionBoardPair(null, board.deepCopy()));
      }
    }
    return returnList;
  }