亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? eval.c

?? gun C 環境下編寫的
?? C
?? 第 1 頁 / 共 3 頁
字號:
 *  winning side to attract the search to such positions.
 *
 **************************************************************************/
{
   int s, winer, sq1, sq2;

   winer = 1^loser;
   if (board.material[winer] == ValueB+ValueN && 
	nbits(board.b[winer][bishop]) == 1 &&
	nbits(board.b[winer][knight]) == 1)
      return (ScoreKBNK (side, loser));

   sq1 = board.king[winer];
   sq2 = board.king[loser];
   s = 150 - 6 * taxicab[sq1][sq2] - EndingKing[sq2];
   if (side == loser)
      s = -s;
   s += MATERIAL;

   return (s);
}


int KPK (int side)
/**************************************************************************
 *
 *  A KPK endgame evaluator.  Side is the one on the move.
 *  This is not a perfect evaluator, it merely identifies SOME positions
 *  as wins or draw.  Some WON positions could be seen as draws; the search
 *  will be able to use the knowledge here to identify more positions.
 *
 **************************************************************************/
{
   int winer, loser, sq, sqw, sql;
   int s;

   winer = (board.b[white][pawn] ? white : black);
   loser = 1 ^ winer;
   sq  = leadz (board.b[winer][pawn]);
   sqw = board.king[winer];
   sql = board.king[loser];
   s = ValueP + (ValueQ * Passed[winer][RANK(sq)] / PFACTOR) + 
	 4 * (winer == white ? RANK(sqw) : 7-RANK(sqw));

/**************************************************************************
 *
 * Pawn is outside the square of the king 
 *
 **************************************************************************/
   if (~SquarePawnMask[winer][sq] & board.b[loser][king])
   {
      if (!(MoveArray[king][sql] & SquarePawnMask[winer][sq]))
         return (winer == side ? s : -s);
      if (winer == side)
         return (s);
   }

/**************************************************************************
 *
 *  Friendly king is on same or adjacent file to the pawn, and the pawn is 
 *  on a file other than a rook file and ...
 *
 **************************************************************************/
   if (ROW(sq) != 0 && ROW(sq) != 7 &&
        ((IsolaniMask[ROW(sq)] | FileBit[ROW(sq)]) & board.b[winer][king]))
   {

/**************************************************************************
 *
 * a. friendly king is 2 ranks more advanced than the pawn 
 * b. friendly king is 1 rank more advanced than the pawn 
 *    i.  The friendly king is on the sixth rank.
 *    ii. The enemy king does not have direct opposition by being 2 ranks
 *        in front of the friendly king and on the same file.
 * c. friendly king is same rank as pawn
 *    i.  The enemy king is not 2-4 ranks more advanced that the pawn.
 *    ii. The pawn is on the sixth rank and the enemy king does not have
 *        direct opposition.
 * d. pawn is on the 7th rank, friendly king is on sixth rank and
 *    i.  The enemy king is not on the queening square.
 *    ii. The enemy is on the queening square but both kings are in the same
 *        file.
 * 
 **************************************************************************/
      if (winer == white)
      {
         if (RANK(sqw) == RANK(sq) + 2)
            return (winer == side ? s : -s);
         if (RANK(sqw) == RANK(sq) + 1)
         {
	    if (RANK(sqw) == 5)
               return (winer == side ? s : -s);
            if (sqw < A6) 
	    {
	       if (sqw+16 == sql && winer == side)
		  return (0);
	       else
                  return (winer == side ? s : -s);
	    }
         }
         if (RANK(sqw) == RANK(sq))
         {
            if ((RANK(sql) - RANK(sq) < 2 || RANK(sql) - RANK(sq) > 4) &&
		 winer == side)
	       return (s);
            if ((RANK(sql) - RANK(sq) < 1 || RANK(sql) - RANK(sq) > 5) &&
		 loser == side)
               return (-s);
	    if (RANK(sq) == 5 && sqw+16 != sql)
               return (winer == side ? s : 0);
	 }
	 if (RANK(sq) == 6 && RANK(sqw) == 5)
         {
	    if (sql != sq+8)
               return (winer == side ? s : 0);
	    if (sql == sq+8 && sql == sqw+16)
               return (winer == side ? s : 0);
	 }
      } 
      else
      {
         if (RANK(sqw) == RANK(sq) - 2)
            return (winer == side ? s : -s);
         if (RANK(sqw) == RANK(sq) - 1)
         {
	    if (RANK(sqw) == 2)
               return (winer == side ? s : -s);
	    if (sqw > H3)
	    {
	       if (sqw-16 == sql && winer == side)
	          return (0);
	       else
                  return (winer == side ? s : -s);
	    }	
	 }
         if (RANK(sqw) == RANK(sq))
         {
            if ((RANK(sq) - RANK(sql) < 2 || RANK(sq) - RANK(sql) > 4) &&
		 winer == side)
	       return (s);
            if ((RANK(sq) - RANK(sql) < 1 || RANK(sq) - RANK(sql) > 5) &&
		 loser == side)
	       return (-s);
	    if (RANK(sq) == 5 && sqw+16 != sql)
               return (winer == side ? s : 0);
	 }
	 if (RANK(sq) == 1 && RANK(sqw) == 2)
         {
	    if (sql != sq-8)
               return (winer == side ? s : 0);
	    if (sql == sq-8 && sql == sqw-16)
               return (winer == side ? s : 0);
	 }
      } 
   }  

   return (0);
}


int KBNK[64] = 
{
   0, 10, 20, 30, 40, 50, 60, 70,
  10, 20, 30, 40, 50, 60, 70, 60,
  20, 30, 40, 50, 60, 70, 60, 50,
  30, 40, 50, 60, 70, 60, 50, 40,
  40, 50, 60, 70, 60, 50, 40, 30,
  50, 60, 70, 60, 50, 40, 30, 20,
  60, 70, 60, 50, 40, 30, 20, 10,
  70, 60, 50, 40, 30, 20, 10,  0
};

int ScoreKBNK (int side, int loser)
/****************************************************************************
 *
 *  My very own KBNK routine!
 *
 ****************************************************************************/
{
   int s, winer, sq1, sq2, sqB;

   winer = 1^loser;
   sqB = board.king[loser];
   if (board.b[winer][bishop] & WHITESQUARES)
      sqB = RANK(sqB)*8 + 7 - ROW(sqB);
   sq1 = board.king[winer];
   sq2 = board.king[loser];
   s = 300 - 6 * taxicab[sq1][sq2];
   s -= KBNK[sqB];
   s -= EndingKing[sq2];
   s -= taxicab[leadz(board.b[winer][knight])][sq2];
   s -= taxicab[leadz(board.b[winer][bishop])][sq2];

   /*  King in the central 4x4 region is good! */
   if (board.b[winer][king] & ULL(0x00003C3C3C3C0000))
      s += 20;
   if (side == loser)
      s = -s;
   s += MATERIAL;

   return (s); 
}


static const BitBoard nn[2] = { ULL(0x4200000000000000), ULL(0x0000000000000042) };
static const BitBoard bb[2] = { ULL(0x2400000000000000), ULL(0x0000000000000024) };

int ScoreDev (short side)
/***************************************************************************
 *
 *  Calculate the development score for side (for opening only).
 *  Penalize the following.
 *  .  Uncastled and cannot castled
 *  .  Undeveloped knights and bishops
 *  .  Early queen move.
 *
 ***************************************************************************/
{
   int s;
   int sq;
   BitBoard c;

   /* Calculate whether we are developed */
   c = (board.b[side][knight] & nn[side]) | (board.b[side][bishop] & bb[side]);
   s = nbits(c) * -8;

   /* If we are castled or beyond the 20th move, no more ScoreDev */
   if (board.castled[side] || GameCnt >= 38)
      return (s);

   s += NOTCASTLED;

   /* If the king is moved, nail it, otherwise check rooks */
   if (Mvboard[board.king[side]] > 0) 
      s += KINGMOVED;

   /* Discourage rook moves */
   c = board.b[side][rook];
   while (c) {
     sq = leadz(c);
     CLEARBIT(c, sq);
     if (Mvboard[sq] > 0)
       s += ROOKMOVED;
   }

   /* Penalize a queen that moves at all */
   if (board.b[side][queen])
   {
      sq = leadz (board.b[side][queen]);
      if (Mvboard[sq] > 0)
         s += EARLYQUEENMOVE;
         /* s += Mvboard[sq] * EARLYQUEENMOVE; */
   }

   /* Discourage repeat minor piece moves */
   c = board.b[side][knight] | board.b[side][bishop];
   while (c) {
     sq = leadz(c);
     CLEARBIT(c, sq);
     if (Mvboard[sq] > 1)
	s += EARLYMINORREPEAT;
	/* s += Mvboard[sq] * EARLYMINORREPEAT; */
   }

   /* Discourage any wing pawn moves */
/*   c = board.b[side][pawn] & (FileBit[0]|FileBit[1]|FileBit[6]|FileBit[7]); */
   c = board.b[side][pawn] & ULL(0xc3c3c3c3c3c3c3c3);
   while (c) {
     sq = leadz(c);
     CLEARBIT(c, sq);
     if (Mvboard[sq] > 0) 
	s += EARLYWINGPAWNMOVE;
   }

   /* Discourage any repeat center pawn moves */
/*   c = board.b[side][pawn] & (FileBit[2]|FileBit[3]|FileBit[4]|FileBit[5]); */
   c = board.b[side][pawn] & ULL(0x3c3c3c3c3c3c3c3c);
   while (c) {
     sq = leadz(c);
     CLEARBIT(c, sq);
     if (Mvboard[sq] > 1) 
	s += EARLYCENTERPREPEAT;
   }

   return (s);
}


/*  Array of pointer to functions  */
static int (*ScorePiece[7]) (short) =
{ NULL, ScoreP, ScoreN, ScoreB, ScoreR, ScoreQ, ScoreK };


int Evaluate (int alpha, int beta)
/****************************************************************************
 *
 *  First check to see if this position can be specially dealt with.
 *  E.g. if our bounds indicate that we are looking for a mate score,
 *  then just return the material score.  Nothing else is important.
 *  If its a KPK endgame, call our KPK routine.
 *  If one side has a lone king & the winning side has no pawns then call
 *  the LoneKing() mating driver routine.  Note that there is enough
 *  mating material as we have already check for insufficient mating material
 *  in the call to EvaluateDraw() in search()/quiesce().
 *
 ****************************************************************************/
{
   int side, xside;
   int piece, s, s1, score;
   int npiece[2];
   BitBoard *b;

   side = board.side;
   xside = 1 ^ side;

   /*  If we are looking for a MATE, just return the material */
   if (alpha > MATE-255 || beta < -MATE+255)
      return (MATERIAL); 

   /*  A KPK endgame. */
   if (board.material[white]+board.material[black] == ValueP)
      return (KPK (side));  

   /*  One side has a lone king and other side has no pawns */
   if (board.material[xside] == 0 && board.b[side][pawn] == NULLBITBOARD)
      return LoneKing (side, xside);
   if (board.material[side] == 0 && board.b[xside][pawn] == NULLBITBOARD)
      return LoneKing (side, side);

/****************************************************************************
 *
 *  Lets try a lazy evaluation.  In this stage, we should evaluate all those
 *  features that gives big bonus/penalties.  E.g. squares around king is
 *  attacked by enemy pieces, 2 rooks on 7th rank, runaway passed pawns etc.
 *  This will be the direction, so things will continue to change in this
 *  section.
 *
 ****************************************************************************/
   EvalCall++;
   phase = PHASE;
   b = board.b[white];
   pieces[white] = b[knight] | b[bishop] | b[rook] | b[queen];
   npiece[white] = nbits (pieces[white]);
   b = board.b[black];
   pieces[black] = b[knight] | b[bishop] | b[rook] | b[queen];
   npiece[black] = nbits (pieces[black]);
   s1 = MATERIAL;

   if ((s1 + maxposnscore[side] < alpha || s1 - maxposnscore[xside] > beta) &&
	phase <= 6)
   {
      score = s1;
      goto next;
   }
   s = 0;
   s += ScoreDev (side) - ScoreDev (xside);
   s += ScoreP (side) - ScoreP (xside);
   s += ScoreK (side) - ScoreK (xside);
   s += BishopTrapped (side) - BishopTrapped (xside);
   s += DoubleQR7 (side) - DoubleQR7 (xside);

   s1 = s + MATERIAL;

/**************************************************************************
 *
 *  See if we can have a lazy evaluation cut.  Otherwise its a slow eval.
 * 
 **************************************************************************/

   if (s1 + lazyscore[side] < alpha || s1 - lazyscore[side] > beta)
   {
      score = s1;
   }
   else
   {
      EvalCnt++;

	GenAtaks();
	s1 = HUNGPENALTY * ( EvalHung(side) - EvalHung(xside) );
	FindPins(&pinned);

      for (piece = knight; piece < king; piece++)
      {
         s1 += (*ScorePiece[piece]) (side) - (*ScorePiece[piece]) (xside);
      }
      lazyscore[side] = MAX (s1, lazyscore[side]);
      maxposnscore[side] = MAX (maxposnscore[side], s + s1);
      score = s + s1 + MATERIAL;
   }

/***************************************************************************
 *
 *  Trade down bonus code.  When ahead, trade pieces & not pawns;
 *
 ***************************************************************************/
next:
   if (MATERIAL >= 200)
   {
      score += (RootPieces - nbits(pieces[white] | pieces[black])) * TRADEPIECE;
      score -= (RootPawns - nbits(board.b[white][pawn] | board.b[black][pawn])) 
			* TRADEPAWNS;
   }
   else if (MATERIAL <= -200)
   {
      score -= (RootPieces - nbits(pieces[white] | pieces[black])) * TRADEPIECE;
      score += (RootPawns - nbits(board.b[white][pawn] | board.b[black][pawn]))
			 * TRADEPAWNS;
   }
      
/***************************************************************************
 *
 *  Opposite color bishops is drawish.
 *
 ***************************************************************************/
   if (ENDING && pieces[white] == board.b[white][bishop] && 
                 pieces[black] == board.b[black][bishop] &&
       ((pieces[white] & WHITESQUARES && pieces[black] & BLACKSQUARES) ||
	(pieces[white] & BLACKSQUARES && pieces[black] & WHITESQUARES)))
   {
      score /= 2;
   }
    
/***************************************************************************
 *
 *  When one side has no mating material, then his score can never be > 0.
 *
 ***************************************************************************/
   if (score > 0 && !board.b[side][pawn] && (board.material[side] < ValueR
        || pieces[side] == board.b[side][knight]))
      score = 0;
   if (score < 0 && !board.b[xside][pawn] && (board.material[xside] < ValueR
        || pieces[xside] == board.b[xside][knight]))
      score = 0;
   
   return (score);
}


short EvaluateDraw (void)
/***************************************************************************
 *
 *  This routine is called by search() and quiesce() before anything else
 *  is done.  Its purpose it to check if the current position is a draw.
 *  0.  50-move draw.
 *  1.  If there are any pawns, it is not.
 *  2.  If both sides has anything less than a rook, draw.
 *  3.  If both sides has <= 2 knights only, draw.
 *  4.  If its a KBBK and bishops of same color, draw.
 *
 ***************************************************************************/
{
   BitBoard *w, *b;
   int wm, bm, wn, bn;

   /* 
    * Exception - if we are close to a pawn move, promotion 
    * or capture it is possible a forced mate will follow.
    * So we assume not drawn for 2 moves.
    */

   if ( (GameCnt-Game50) < 5 )
     return (false);

   /* 50 move rule */
   if ( (GameCnt-Game50) > 100 )
     return (true);

   w = board.b[white];
   b = board.b[black];
   if (w[pawn] != 0 || b[pawn] != 0)
      return (false);

   wm = board.material[white];
   bm = board.material[black];
   wn = nbits (w[knight]);
   bn = nbits (b[knight]);
   if  ((wm<ValueR || (wm==2*ValueN && wn==2)) &&
        (bm<ValueR || (bm==2*ValueN && bn==2)))
      return (true); 

   if (wm < ValueR)
   {
      if (bm == 2*ValueB && 
         ( nbits(board.b[black][bishop] & WHITESQUARES) == 2 ||
           nbits(board.b[black][bishop] & BLACKSQUARES) == 2 ))
      return (true);
   }
   if (bm < ValueR)
   {
      if (wm == 2*ValueB && 
         ( nbits(board.b[white][bishop] & WHITESQUARES) == 2 ||
           nbits(board.b[white][bishop] & BLACKSQUARES) == 2 ))
      return (true);
   }

   return (false);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产在线精品一区在线观看麻豆| 亚洲一区国产视频| 欧美午夜精品久久久久久超碰| 日韩av电影一区| 亚洲成a人在线观看| 亚洲激情男女视频| 自拍av一区二区三区| 久久久www成人免费毛片麻豆| 日韩一区二区在线观看视频| 欧美二区在线观看| 欧美一区午夜视频在线观看| 日韩一二在线观看| 一区二区三区四区亚洲| 日韩和欧美一区二区三区| 免费av网站大全久久| 成人丝袜高跟foot| 成人深夜视频在线观看| 日韩手机在线导航| 午夜在线成人av| 色悠悠久久综合| 欧美视频一区二区三区| 日韩理论片网站| 国产成人免费在线视频| 色网站国产精品| 专区另类欧美日韩| 91亚洲精品乱码久久久久久蜜桃| heyzo一本久久综合| 欧美日韩免费观看一区三区| 精品国产伦一区二区三区免费 | 日韩精品一区二区三区老鸭窝| 精品va天堂亚洲国产| 久久精品国产秦先生| 97精品国产露脸对白| 欧美久久免费观看| 亚洲成人黄色小说| 欧美精品日韩精品| 日韩精品免费视频人成| 5566中文字幕一区二区电影| 国产欧美一区二区精品性色| 亚洲六月丁香色婷婷综合久久 | 国产一区不卡视频| 精品国产乱码久久久久久蜜臀| 日韩福利视频导航| 欧美精品一区二区精品网| 国产精品理论在线观看| 精品999在线播放| 国产精品综合一区二区| 欧美午夜理伦三级在线观看| 一区二区三区精品| 欧美精品亚洲一区二区在线播放| 天堂精品中文字幕在线| 精品动漫一区二区三区在线观看| 国产精品一二三四五| 中文字幕第一区综合| 久久激情五月婷婷| 国产欧美视频一区二区| av电影天堂一区二区在线| 一二三区精品福利视频| 日韩欧美电影在线| 国产69精品久久久久777| 日韩欧美一区二区视频| 国产成人鲁色资源国产91色综| 亚洲男人的天堂在线aⅴ视频| 国产激情视频一区二区三区欧美| 中文字幕在线视频一区| 国产精品香蕉一区二区三区| 自拍偷拍欧美精品| 欧美mv日韩mv| 久久国内精品视频| 国产精品久久久久一区二区三区共| 91国偷自产一区二区三区成为亚洲经典| 国产精品视频yy9299一区| 日本乱人伦aⅴ精品| 国产一区二区三区四区五区入口 | 婷婷中文字幕综合| 91福利资源站| 久久99精品国产.久久久久久| 777奇米四色成人影色区| 韩国精品免费视频| 亚洲一区二区三区四区在线免费观看 | 综合激情网...| 欧美成人三级电影在线| 色天天综合色天天久久| 国产成人一区在线| 日本aⅴ亚洲精品中文乱码| 中文字幕不卡在线播放| 精品乱人伦小说| 欧洲一区二区三区在线| 一区二区三区日韩精品视频| 精品国产免费人成电影在线观看四季| 色哟哟一区二区| 大陆成人av片| 激情六月婷婷久久| 日日夜夜精品免费视频| 亚洲免费资源在线播放| 国产欧美一区视频| 精品精品国产高清a毛片牛牛 | 成人涩涩免费视频| 国产精品综合视频| 久久精品国产久精国产爱| 天天综合网 天天综合色| 亚洲手机成人高清视频| 国产精品国产三级国产aⅴ入口| 26uuu另类欧美亚洲曰本| 欧美一级精品在线| 欧美精品123区| 7777精品伊人久久久大香线蕉完整版 | 亚洲精品中文在线影院| 欧美国产欧美亚州国产日韩mv天天看完整| 欧美日韩国产精品自在自线| 麻豆一区二区三区| 国产精品国产三级国产三级人妇| 精品美女一区二区| 久久香蕉国产线看观看99| 精品国产一区二区三区久久久蜜月 | 18成人在线观看| 国产精品久久毛片av大全日韩| 国产日韩欧美在线一区| 国产亚洲一区二区三区在线观看 | 欧美日韩的一区二区| 欧美日韩一区在线| 欧美日本在线看| 日韩一区二区在线免费观看| 日韩美女天天操| 国产日韩精品一区| 中文字幕中文字幕中文字幕亚洲无线| 国产精品天天看| 亚洲日本电影在线| 亚洲一本大道在线| 国产精品初高中害羞小美女文| 国产精品天干天干在线综合| 亚洲三级小视频| 亚洲成人久久影院| 蓝色福利精品导航| 国产.精品.日韩.另类.中文.在线.播放| 大白屁股一区二区视频| 91美女在线视频| 69久久夜色精品国产69蝌蚪网| 日韩一区二区精品葵司在线| 久久网站热最新地址| 亚洲伦理在线免费看| 日韩黄色小视频| 懂色av一区二区在线播放| 91在线一区二区三区| 欧美一区二区私人影院日本| 国产亚洲精品超碰| 亚洲一区二区三区四区在线免费观看 | 国内精品写真在线观看| 91麻豆蜜桃一区二区三区| 欧美一区二视频| 国产精品国产三级国产有无不卡| 一区二区三区中文在线| 韩国欧美国产一区| 91国产福利在线| 久久久高清一区二区三区| 夜夜精品浪潮av一区二区三区| 美腿丝袜亚洲三区| 色婷婷综合久久久中文一区二区| 日韩欧美国产精品一区| 亚洲伦理在线精品| 国内精品伊人久久久久影院对白| 色欧美乱欧美15图片| 久久久久99精品国产片| 一区二区欧美在线观看| 国产一区二区三区免费播放| 欧美日韩精品一区二区在线播放| 久久亚洲一区二区三区四区| 亚洲自拍欧美精品| 成人av在线影院| 91年精品国产| 久久先锋影音av鲁色资源网| 性欧美大战久久久久久久久| 成人91在线观看| 精品国产免费视频| 日韩成人一区二区三区在线观看| 懂色av一区二区三区免费看| 欧美一区二区三区喷汁尤物| 亚洲一区自拍偷拍| 成人h动漫精品| 国产欧美视频一区二区三区| 久久精品理论片| 5858s免费视频成人| 一个色综合网站| 色婷婷av一区二区三区之一色屋| 久久精品人人做人人综合 | 国产日本欧美一区二区| 久久精品国产免费看久久精品| 欧美日韩国产影片| 一区二区三区中文在线观看| yourporn久久国产精品| 国产网站一区二区| 国产美女一区二区| 欧美精品一区二区三区蜜桃| 久久精品理论片| 亚洲精品在线一区二区| 久久99精品久久久久久久久久久久| 日韩欧美一级片| 国产自产高清不卡| 国产欧美一区二区三区鸳鸯浴| 久久99精品网久久|