This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I want to add history heuristics for my game of connect four.
Till now I have programed fully functional connect-4 ai implementing negamax algorithm and basic evaluation function.
Later on added alpha beta pruning to it so that the search time would be low(It does work, it drastically reduces).
Now to optimize it further, I would like to add history heuristics to it and later on transposition table.
Here is the code for negamax.
The above code is for negamax+abp
The sort method sorts all the indexes of array in descending order(Maximum value will be fed first to negamax_ab, this is called as history heuristics).
the array curr_val is global parameter which has length of 7.It stores all the values returned from the negamax_ab().
These values are then stored in array called as vals which has same size as that of possible move.
Even by this, The time required to search is the same without history heuristics.