Tree representation in java for minimax algorithm

606 views Asked by At

I want to implement the Minimax algorithm in java. I couldnt find a good tree representation. Is there an existing one or should I make my own?

  • by the way this is for the pacman game Thanks
1

There are 1 answers

2
Andy Thomas On

You don't need one.

The minimax algorithm is frequently illustrated with a tree.

However, that tree represents the steps taken by the algorithm to choose the best move. It is not a data structure held by the algorithm.

Instead, you'll use iteration and recursion. At each interior node of the tree, you'll iterate through the children, and use recursion on each child.