Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: more explanation - better programming habits than Rybka

Author: Nathan Thom

Date: 16:31:46 02/15/06

Go up one level in this thread



>>>Thanks, I understand. However, why wouldn't the Q search return moves like e4 or
>>>d4 as the piece square tables favour that over something stupid like h3.
>>
>>You didn't explain how your scoring system works.
>>
>>On the other hand, i remember Uri once defending 1.h3 as a reasonable test
>>opening. So why not ask Uri?
>>
>>In general however, bugs in engines explain a lot.
>>
>>Like perhaps you return the positional score for the wrong side. Automatically
>>it will try to pick the worst move then as you are not doing a minimax then but
>>a maximin :)
>>
>>Vincent
>
>Hi, some more thoughts on this subject, not taking into account extensions and
>not a lot of good other interesting things :)
>
>Something like this, of course using fail soft alfabeta and principal
>variationsearch.
>
>int qsearch(int alfa,int beta,int side) {
>  int eval;
>
>  eval = evaluate(); // evaluate returns score from white side
>  if( side )
>    eval = -eval;
>
>  if( eval >= beta ) return eval;
>
>  generateinterestingmoves(side);
>  for( all interesting moves ) {
>    score = -qsearch(-beta,-alfa,side^1);
>    if( score > eval ) {
>      eval = score;
>      if( score >= beta ) break;
>    }
>  }
>  return eval;
>}
>
>int pvs(int side,int alfa,int beta,int depthleft) {
>  int bestscore;
>  if( depth <= 0 )
>    return(qsearch(alfa,beta,side));
>
>  pick( first move );
>  bestscore = -pvs(side^1,-beta,-alfa,depthleft-1);
>  if( bestscore >= beta ) return bestscore;
>
>  for( all moves ) {
>    int tempscore = -pvs(side^1,-alfa-1,-alfa,depthleft-1);
>    if( tempscore > alfa && tempscore < beta )
>      tempscore = -pvs(side^1,-beta,-alfa,depthleft-1);
>    if( tempscore > alfa ) {
>      bestscore = tempscore;
>      if( tempscore >= beta ) break;
>      alfa = tempscore;
>      !!!!! // here you should update your mainline in a correct manner !!!
>    }
>  }
>  return bestscore;
>}
>
>Please try to use good programming habits, for example some strong commercial
>programmers really have very bad habits here which you should not take over.
>Like i use clearly a local side to move. That's a better programming habit than
>for example Rybka from which i am guessing it is using a global side to move
>variable.
>
>That is very ugly way to program an engine and should be avoided!
>
>It might prevent some bugs in your program which we all had :)
>
>Also try to avoid the 'goto' command and such.
>
>Vincent

Thanks, I intend to add these more advanced search techniques soon - I just want
to make sure everything I add is 100% correct before continuing. I've had
several unsuccessful attempts at writing engines mainly because I was too eager
to jump straight in to the deep end.

I'm a professional programmer and am quite shocked at most of the engine code
I've seen around... I also spend alot of time performance tuning different
programs/databases and think that sloppy coding for performance reasons is
simply an excuse for laziness :)



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.