... Now come the method of minmax(same as negamax+ab in this program).
I want the ab pruning to behave in same way as that of negamax
Gurudas Bhandarkar wrote:I think there is confusion here the name of function is minmax,but it is written in negamax fuction.. so to refer it by name, i I think the pseudo code that you wrote helped me but that is not the way in which I have written my negamax function. If you look at my code then you will find the variable preValue which stores the highest score. If it has connect in four then it straight away displays the (MAX_RECURDEPTH-prevalue) as score to win,for all rest till it does not find win it displays score as zero. By writing a score function, I mean it evaluates each position and then shows up like for example if computer has a slightly better position then it shows 0.24 or something like that, this is what I have not written as of now. As my code is working without the score function.(just now I tried to explain you what score function means in my program.)implementing the only negamax code, it should work with negamax+abp as well.
The reason I think that it does not work is in either the if's or in the return a rest I think there is no problem(as I have not modified my original negamax code which is fully working so trying to work there, please help me if you find the correct code or correct sequence of coding)
I think the confusion is being cleared of minmax and negamax. so to end with confusion I will give an short example:
even if you call rose as lily, it will still remain rose. In same way I have named negamax as minmax, but still it will be negamax.
Need your help.
Gurudas Bhandarkar wrote:@Fred
I understood your code. (Your comments made it easier!)
But only one problem between your code and mine: I have not created a copy of the board.as you can see in my code, I have declared everything as static variables. more over, I tried to make copy of it and tried to fit in your code, it played worse and made moves for human player as well.
Gurudas Bhandarkar wrote:@fred
When I looked at your code, it seemed pretty fine. But I guess certain things have been missed out.
You did not undo the moves (When I tried to implement it without undoing the moves it gave me array out-of-bound exception) secondly,When I tried to implement it in my game it did not look for win,neither for itself nor for the opponent. Here is the code which I modified.Please take a careful look at it. (I don't have much time to program now as my college will start and then I must begin with my studies(electronics). So I am trying to fix this bug as soon as possible.Please Help)