Sign in to follow this  

minimax with alpha beta pruning implementation stuck.

This topic is 1913 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

It looks to me like you got the sign wrong. But you should learn how to debug your code. That position seems to be solvable with a depth-1 search, and that should be relatively easy to debug.

Share this post


Link to post
Share on other sites
[quote name='alvaro' timestamp='1350840683' post='4992490']
It looks to me like you got the sign wrong. But you should learn how to debug your code. That position seems to be solvable with a depth-1 search, and that should be relatively easy to debug.
[/quote]

What do you mean by wrong sign ? Where ?
For both players ("computer" or "human") the function returns a positive score, i.e. everybody is trying to maximize score, right?

You're saying that at depth=1 , the function should return best move (score) ? If so, i can confirm that (it returns biggest score for current player) !
Please help . Edited by whitenose

Share this post


Link to post
Share on other sites
This looks like the wrong sign:
[code] if(sign==-1) return total;
else return -total;
[/code]

But perhaps I didn't understand your sign convention.

I am not sure how to help further. You need to find a situation where the program reproducibly does the wrong thing, then carefully analyze what the program is doing, probably with the help of a debugger or perhaps just by adding a bunch of print statements to your program. Try to figure out where the program is doing something different than what you expected.

Share this post


Link to post
Share on other sites

This topic is 1913 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this