コード例 #1
0
  public Move get1stMove(
      Game game, CheckersSetup setup, checkersSetup.Board board, ArrayList<Move> choices) {
    // BasicCheckersAIFunctions.delayCompALittle();

    // start fresh after every turn:
    viewedPos = null;
    // TESTING
    numPosRecorded = 0;
    // END TESTING

    numJumpsAlreadyDoneThisTurn = 0;

    BasicCheckersAIFunctions.printAllAIPlayerOptions(setup, isDarkPlayer);

    desiredTurn = getBestMoveBasedOnSearchOfDepthN(setup, isDarkPlayer, this.depth);

    ArrayList<Move> desiredMoves = desiredTurn.getMovesFor1Turn();

    BasicCheckersAIFunctions.PrintDesiredMoves(desiredMoves);

    if (desiredMoves.get(0).isJump()) {
      numJumpsAlreadyDoneThisTurn++;
    }

    // TESTING (Display)
    System.out.println("Number of positions analysed for AI with Tree: " + numPosRecorded);
    if (viewedPos != null) {
      System.out.println("Height of tree: " + viewedPos.getHeightOfTree());
    }
    System.out.println();
    // END TESTING

    return desiredMoves.get(0);
  }
コード例 #2
0
  public Move getNextJumps(
      CheckersSetup setup, checkersSetup.Board board, ArrayList<Move> multiJumpChoices) {
    // BasicCheckersAIFunctions.delayCompALittle();

    // get the next move in the desired multi jump choice:
    Move move = desiredTurn.getMovesFor1Turn().get(numJumpsAlreadyDoneThisTurn);

    // Testing
    BasicCheckersAIFunctions.doSanityCheckMakeSureCompMoveIsRealMove(
        desiredTurn.getMovesFor1Turn().get(numJumpsAlreadyDoneThisTurn), multiJumpChoices);
    // Testing

    numJumpsAlreadyDoneThisTurn++;

    return move;
  }