This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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.