2

To improve performance of Minimax algorithm with Alpha-Beta pruning, I've implemented Iterative deepening:

 public Integer iterativeDeepening(int maxDepth, boolean isFirstPlayer) {

    Integer bestCell = -1;

    for (Integer depth = 1; depth <= maxDepth; depth++) {
        bestCell = alphabeta.minimax(depth, false, Integer.MIN_VALUE, Integer.MAX_VALUE)[1];
    }

    return bestCell;
}

where method iterativeDeepening simply returns id of best move.

Firstly, I am not sure if this is correct way to implement Iterative Deepening.

Secondly, I noticed that AI started making wrong moves. Is it possible for Iterative Deepening to affect decision making?

While working with Transposition tables and Iterative Deepening, I measure significant improvements to algorithm speed, but I don't really want to sacrifice AI quality for speed.

Sarpy
  • 265
  • 1
  • 7
  • 18

1 Answers1

4

Firstly, I am not sure if this is correct way to implement Iterative Deepening.

I think it is correct, but if you want iterative deepening to speed your algorithm up, you should also add move ordering to it. The idea is that you use results from shallower search, and search moves that seem the best as first at the next iteration. This means a better chance for fast cut-offs in your alpha-beta algorithm.

Secondly, I noticed that AI started making wrong moves. Is it possible for Iterative Deepening to affect decision making?

Implementing iterative deepening for your alpha-beta algorithm should not affect the decision making at all. There must be something wrong with your implementation, but there's not enough information to say what it is.

user2203031
  • 402
  • 3
  • 14