Question

I'm trying to develop a chess program. It will be regular bruteforce searching of a tree, the only thing different will be the evaluation. Initially I will use a standard evaluator as designed by Claude Shannon so that it is more easy to test if it works fine at the base. Move list generation and all other infra around it works fine.

Now for the searching: I would like to use the alpha/beta pruning code example of wikipedia. And that's what is a bit of a problem: it is ambiguous about one thing; from who's perspective should the evaluation be done? I've been googling for days (literally) but no example says this explicitly. So: should the evaluation be

  • from the point of view of the "current mover" at that depth
  • from the point of view of the "opponent of current move" at that depth
  • from the point of view of the mover at the root of the tree, e.g. the person for who this tree-search is being done (the AI player)
  • from the point of view of the opponent of the mover at the root of the tree

?

I experimentally tried rootSide, side, rootOpponent, well basically all options and then let them play against each other. The outcome of that was that "current mover at that depth" would be the one to use (it won most frequently) but testing that version against any other engine result in 100% loss.

Of course wikipedia will be updated to be more clear about it! (please ignore the note on the side in the wikipedia history: that was from myself which might be incorrect so I removed it)

Was it helpful?

Solution

Evaluation should be performed from the perspective of the node invoking it. This is your first case, and it is the only one that really makes sense.

If you're testing your very basic engine against other complete engines then yes you can expect to lose every match. You are missing lots of techniques so playing against other engines is not a good method of testing right now. Once your engine is stronger then yes you can use this method to improve strength or perform regression testing.

I'd recommend setting up simple positions and playing with it manually to look at whether it can see basic captures, checks, checkmates, etc. Be warned that even with a perfect implementation of alpha-beta and simple evaluation that your engine will still blunder at times. This is because of the fixed search horizon so next you may want to look into quiescence search.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top