# Naive minmax optimizations

I'm working on a perfect information game in my spare time. I've implemented a naive minmax algorithm for the computer player. I've further optimized it using alpha-beta pruning.

What I'm looking for is next logical steps to improve the speed of the search (currently the computer player searches 5 nodes deep with acceptable time taken).

-

## 2 Answers

The most obvious next step is to cache the tree, hang on to the calculations you already made for the branch chosen, and use the time saved by not recalculating it to extend it further.

Depending on how confident you can be that your cost function is accurate, it might be worth trying to improve it. You may be able to semi-automate this using genetic algorithms to improve it by having different versions play against each other.

-
There's a lot i could do with my cost function - so I'll go work on that. As for caching - there might be more then one ai opponent. In this case I think I'd have to share the calculations between them. I have to think some more on the subject :) Thanks! – Goran Feb 13 '11 at 17:38

You mention that there may be more than one AI opponent. Just note that alpha-beta pruning doesn't work for more than 1 opponent (although you can look into Paranoid Search). Next steps are to look at move ordering, branch and bound pruning and transposition tables (which is probably the same as caching mentioned earlier)

-
I've extended the algorithm a bit. Keeping track of score (and guaranteed score) for each player. Score for all players is calculated on every move. So it's not hard to prune the branch where choosing a particular move results in a lower-then-guaranteed score for a player. Are there any other reasons why this algorithm can't be extended to n players? – Goran Mar 30 '11 at 9:50
when there is a third player you can not prune grandfather nodes as the other players score (not involved in the prune) can affect the outcome. there is quite a bit of literature on this. checkout citeseerx.ist.psu.edu/… – Druzil Mar 31 '11 at 6:03