Hi,
i just setup a plain alphaBeta searcher with the following functions.
Then i began to examine some positions of my perft collection.
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
"r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R KQkq -0 1"
it doesnt take long to realize that the qsSearch is very sensible on the
4 different types of evaluation (added the testcode at the end of my post)
a: evaltype 1 function
================
- has a average cut rate(standpat) of 50% +-10%, so moving around the 50%
b: evaltype 2 function
================
- has a very hi average cut rate(standpat) of 90%+ moving direction towards 100%
c: evaltype 3 function
================
- the worst cut rate(standpat) 10(35)% moving direction towards 0
first impressions
================
1.
well i know that making conclusions right now is not very scientific approach,
_but_ due to the effects which presents _significant_
results,differences (described above) the type "2" random evaluation seems
to have the most similar behaviour in comparison with a _normal_
evaluation concept. ("normal"=like given here as material evalution term).
2.
each of the functions should (not tested yet), have a different
_playing strength_ because they will reach _totally_ different depths
at the same time available. At the end the _sampled_ mobility
will be more accurate the deeper we go (right?), and further
will give more strength.
3.
we do not sample mobility, we are sampling "tactical_mobility" if
we use quiesence search, or not ?
maybe there is a strong correlation
between mobility and tacticalmobility. i simply dont know.
but more important then to differentiate between minimax(mm)
and alphabeta(ab), maybe to differetiate between (mm,ab) and a selective and unlimited search like qsSearch.
Or in other words, what role does qsSearch has in Beals experiments?!
so that were just confusing thoughts
and now the code...
Code: Select all
static value_t test_eval(position_t *pos)
{
// 1: (-50,50)
return(rand()%101-50);
// 2: (0,100)
//return(rand()%101);
// 3: (-100,0)
//return(-(rand()%101)); //(-100,0)
// 4: material()
value_t v = valueBalanced;
v += pos->pieceCount[wpEnum] * 100;
v += pos->pieceCount[wnEnum] * 300;
v += pos->pieceCount[wbEnum] * 300;
v += pos->pieceCount[wrEnum] * 500;
v += pos->pieceCount[wqEnum] * 1000;
v -= pos->pieceCount[bpEnum] * 100;
v -= pos->pieceCount[bnEnum] * 300;
v -= pos->pieceCount[bbEnum] * 300;
v -= pos->pieceCount[brEnum] * 500;
v -= pos->pieceCount[bqEnum] * 1000;
return(pos->ctm==white ? v : -v);
}
Code: Select all
static value_t test_ab(position_t *pos,
value_t alpha,
value_t beta,
ply_t rdp,
ply_t cdp)
{
undo_t undo[1];
movestack_t mst[1];
move_t move;
int nb_legal = 0;
int value = valueNone;
//horizon
if(rdp < onePly) {return(test_qs(pos,alpha,beta,rdp,cdp));}
nodes++
//generate all moves
movestack_clr(mst);
generate_tactic[pos->ctm](pos,mst);
generate_quiet[pos->ctm](pos,mst);
//just needed to verify legal moves
pos->incheck = inCheck(pos);
pos->pinned = pinned(pos,pos->ctm);
while((move=movestack_pick(mst))!=moveNone && alpha<beta)
{
if(!pseudo_is_legal(pos,move)) continue;
nb_legal++;
move_do(pos,undo,move);
value = -test_ab(pos,-beta,-alpha,rdp-onePly,cdp+1);
if(value > alpha) alpha = value;
move_undo(pos,undo,move);
}
// mate,stalemate
if(nb_legal == 0)
{
if(pos->incheck) return(lBound+cdp);
else return(0);
}
return(alpha);
}
Code: Select all
static value_t test_qs(position_t *pos,
value_t alpha,
value_t beta,
ply_t rdp,
ply_t cdp)
{
undo_t undo[1];
movestack_t mst[1];
move_t move;
int value = valueNone;
nodes++;
// standpat
value = test_eval(pos);
if(value >= beta) return(beta);
if(value > alpha) alpha = value;
// generate captures,promotions
movestack_clr(mst);
generate_tactic[pos->ctm](pos,mst);
//just needed to verify legal moves
pos->incheck = inCheck(pos);
pos->pinned = pinned(pos,pos->ctm);
while((move=movestack_pick(mst))!=moveNone && alpha<beta)
{
if(!pseudo_is_legal(pos,move)) continue;
move_do(pos,undo,move);
value = -test_ab(pos,-beta,-alpha,rdp-onePly,cdp+1);
if(value > alpha) alpha = value;
move_undo(pos,undo,move);
}
return(alpha);
}
if i have missed sth. totally, pls let me know.
Michael