I had a question about iterative deepening.
Basically, at the root, when I get a fail-low and a fail-high what should I do?
I've tried in pseudocode:
Code: Select all
if(Score > beta)
Raise beta by x centipawns and move onto the next root move
if(Score < alpha)
Lower alpha by x centipawns and move onto the next root move
The reason I'm bringing this up is the strange output from my engine when I tell it to move after g3 e5 a3 Qh4--white should be winning by about 800 centipawns. Yet here is the output from the engine:
Code: Select all
Chess 230716
A chess engine by David Cimbalista
Copyright (c) 2015
position startpos
moves g2g3 e7e5 a2a3 d8h4
go wtime 30000 btime 30000
info depth 1
info multipv 1 depth 1 seldepth 4 score cp 760 hashfull 4 pv g3h4 time 320 nodes
123204 nps 383000
info depth 2
info multipv 1 depth 2 seldepth 5 score cp 760 hashfull 4 pv g3h4 time 324 nodes
123264 nps 379000
info depth 3
info multipv 1 depth 3 seldepth 6 score cp 0 hashfull 4 pv a1a2 time 328 nodes 1
23536 nps 375000
info depth 4
info multipv 1 depth 4 seldepth 7 score cp 5 hashfull 5 pv c2c4 b8a6 g1h3 time 3
40 nodes 124797 nps 365000
info depth 5
info multipv 1 depth 5 seldepth 8 score cp 5 hashfull 5 pv c2c4 b8a6 g1h3 time 3
50 nodes 125243 nps 356000
info depth 6
info multipv 1 depth 6 seldepth 9 score cp 25 hashfull 7 pv c2c4 h4h3 d2d3 b8a6
c1h6 time 368 nodes 128692 nps 348000
info depth 7
info multipv 1 depth 7 seldepth 10 score cp 5 hashfull 11 pv c2c4 h4h3 d2d3 h3g2
g1h3 b8a6 time 406 nodes 144188 nps 354000
info depth 8
info multipv 1 depth 8 seldepth 11 score cp 0 hashfull 34 pv c2c4 h4h3 d2d3 h3g4
f2f3 b8a6 g1h3 time 543 nodes 200917 nps 369000
info depth 9
bestmove c2c4
Also, I have one more question:
In iterative deepening should I be calling alpha beta like this:
Code: Select all
int Score = AlphaBeta(rootAlpha, rootBeta, depth - 1);
Code: Select all
int Score = -AlphaBeta(-rootAlpha, -rootBeta, depth - 1);
And how should I be handling the value returned from the Alpha-Beta search(should I check for greater than beta, less than alpha, or some other way)?
Thanks for the help!
David Cimbalista