1: #include "old.h"
   2: 
   3: /*
   4:  *	mobility
   5:  *	1 for each potential move
   6:  */
   7: 
   8: bheur1()
   9: {
  10: 
  11:     return(-wheur1());
  12: }
  13: 
  14: /*
  15:  *	opening 'goodies'
  16:  *	10 for each minor piece out
  17:  *	-10 for blocking kq pawns
  18:  */
  19: 
  20: bheur2()
  21: {
  22:     int i, mt;
  23: 
  24:     i = 0;
  25:     if(game > 2) return(i);
  26:     mt = amp[-1];
  27:     if(mt == 2 || mt == 3) i += 30;
  28:     if(mt == 0) i -= 20;
  29:     i += 9*((board[1] != 2)+
  30:         (board[6] != 2));
  31:     i += 8*((board[2] != 3)+
  32:         (board[5] != 3));
  33: 
  34:     /*
  35: 	 * -10 for blocked central pawns
  36: 	 */
  37:     if(board[11]==1 && board[11+8]!=0) i -= 10;
  38:     if(board[12]==1 && board[12+8]!=0) i -= 10;
  39:     return(i);
  40: }
  41: 
  42: /*
  43:  *	ability to castle
  44:  *	22 for both flags
  45:  *	20 for one flag
  46:  */
  47: 
  48: bheur3()
  49: {
  50:     int i;
  51: 
  52:     i = 0;
  53:     /*
  54: 	 * queenside ability
  55: 	 */
  56:     if(flag&020 && board[8]==1 && board[9]==1 && board[10]==1)
  57:         i += 20;
  58:     /*
  59: 	 *  kingside ability
  60: 	 */
  61:     if(flag&010 && board[13]==1 && board[14]==1 && board[15]==1)
  62:         i += 20;
  63:     /*
  64: 	 * if both
  65: 	 */
  66:     if(i == 40)
  67:         i = 22;
  68:     /*
  69: 	 * if castled,
  70: 	 * keep pawns in
  71: 	 */
  72:     if(bkpos==2)
  73:         if(board[10]==1 && (board[8]==1 || board[8+8]==1) &&
  74:             (board[9]==1 || board[9+8]==1))
  75:                 i += 40;
  76:     if(bkpos==6)
  77:         if(board[13]==1 && (board[14]==1 || board[14+8]==1) &&
  78:             (board[15]== -1 || board[15+8]== -1))
  79:                 i += 40;
  80:     return(i);
  81: }
  82: 
  83: /*
  84:  *	prance
  85:  *	a percentage if the
  86:  *	piece on the move
  87:  *	can be driven back
  88:  *	by a smaller piece
  89:  */
  90: 
  91: bheur4()
  92: {
  93:     int *p1, *p2, ploc, i;
  94: 
  95:     if(amp[-1] != 1) return(0);
  96:     ploc = amp[-3];
  97:     if(board[ploc] == 1) return(0);
  98:     if(xheur(ploc)) return(0);
  99:     p1 = lmp;
 100:     p2 = p1;
 101:     wagen();
 102:     i = 0;
 103:     while(p2 != lmp) {
 104:         p2++;
 105:         wmove(*p2++);
 106:         i = xheur(ploc);
 107:         wremove();
 108:         if(i)
 109:             break;
 110:     }
 111:     lmp = p1;
 112:     return(-i);
 113: }
 114: 
 115: /*
 116:  *	control
 117:  *	center control
 118:  *		opening
 119:  *		beginning
 120:  *	king control
 121:  *		middle
 122:  *		end
 123:  */
 124: 
 125: bheur5()
 126: {
 127: 
 128:     return(-wheur5());
 129: }
 130: 
 131: /*
 132:  * mate threat
 133:  * bad to capture
 134:  */
 135: bheur6()
 136: {
 137:     int i;
 138: 
 139:     *amp++ = -1;
 140:     i = 0;
 141:     if(battack(wkpos))
 142:         if(mate(2, 0))
 143:             i += 15;
 144:     amp--;
 145:     return(i);
 146: }

Defined functions

bheur1 defined in line 8; used 2 times
bheur2 defined in line 20; used 2 times
bheur3 defined in line 48; used 2 times
bheur4 defined in line 91; used 2 times
bheur5 defined in line 125; used 2 times
bheur6 defined in line 135; used 2 times
Last modified: 1987-08-04
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2282
Valid CSS Valid XHTML 1.0 Strict