nivik
nivik

Reputation: 51

What type of tree should I use for Minimax

I am building an application of checkers.

I have started to build the AI and I've read alot about minimax.

There is something that i couldn't understand, what type of tree should I use to build the "game tree" (I'm programming in JAVA)

Upvotes: 2

Views: 2990

Answers (2)

Codor
Codor

Reputation: 17605

The minimax algorithm can also be implemented without explicitly encoding the game tree. In each recursive step, the move is actually done on some representation of the game board, then recusively calling the evaluation again, and after evaluation un-doing the move to evaluate. This approach is more memory efficient as only the node of the game tree in consideration is explicitly represented. In this approach, the call stack and the game board representation together can be interpreted as node iterator for the game tree.

Upvotes: 0

sprinter
sprinter

Reputation: 27946

In general minimax game trees are simple: each node represents a state of the game and contains a collection of all child nodes representing all the allowed moves from that state.

Here is a possible implementation:

class Node {
    private Board state;
    private Map<Move, Node> children;
}

Upvotes: 2

Related Questions