Reputation: 108
I am having problems regarding my implementation of the minimax algorithm in a chess engine. How can I make the algorithm favor the shortest paths to the win?
Take this configuration of the board as an example:
The best move here would be to move the queen on the last line, but if the algorithm has a higher depth of search it doesn't matter if the checkmate occurs "faster".
Upvotes: 0
Views: 377
Reputation: 51063
A few fairly straightforward changes:
Note that this will generally make the algorithm less efficient, since you have to explore more branches after finding a winning move in case there is a quicker winning move in the unexplored branches.
Upvotes: 1