Author: Dann Corbit
Date: 13:59:37 11/08/01
Go up one level in this thread
Here is a profile of boardStruct::boardControlEval(), which is where all of your
time is going. I got a small benefit by this precalculation:
int ksw = kingSquare[WHITE];
int ksb = kingSquare[BLACK];
which is strange, since you would think the compiler would do that for you.
Address Line Clockticks Source
42 int boardStruct::boardControlEval()
01:DF20 43 105 {
44
45
46 " int mhold_white,"
47 mhold_black;
48 int sqcontrol;
01:DF34 49 3 int control = 0;
50 square sq;
51 " bitboard nearKingWhite,"
52 nearKingBlack;
53
01:DF39 54 115 nearKingWhite = nearSquares[kingSquare[WHITE]];
01:DF50 55 59 nearKingBlack = nearSquares[kingSquare[BLACK]];
56
57
01:DF6A 58 833 mhold_white = (getMaterialInHand(WHITE) / 200) + 2;
01:DFAC 59 3517 mhold_black = (getMaterialInHand(BLACK) / 200) + 2;
60
61
01:DFCF 62 54 " removeAttacks(WHITE, KING, kingSquare[WHITE]); /*
We don't want to"
63 * count the
king
64 * attacks */
01:E050 65 2802 " removeAttacks(BLACK, KING, kingSquare[BLACK]);"
66
01:E0C0 67 16 int ksw = kingSquare[WHITE];
01:E0C6 68 24 int ksb = kingSquare[BLACK];
01:E0CC 69 3045 for (sq = A1; sq <= H8; sq++) {
01:E0F0 70 3189 sqcontrol = attacks[WHITE][sq] -
attacks[BLACK][sq];
71
72 // Control bonus for every square
01:E109 73 12280 control += ((ControlTable[sq][ksw] +
ControlTable[sq][ksb]) * sqcontrol);
74
75
76
77 // Near Black King
78
01:E122 79 6173 if (nearKingBlack.squareIsSet(sq)) {
80 // Bonus for squares we attack more then opp near opps king
81 // or that are empty and as often defended as attacked
01:E145 82 1789 if ((sqcontrol > 0) || ((sqcontrol == 0) &&
(position[sq] == NONE)))
01:E0CE 83 592 control += (mhold_white * BC_FACTOR *
(sqcontrol + 1));
84 // Bonus for escape squares near our own king
85 // squares that are empty and defended by us and not
attacked by
86 // opp
01:E15C 87 1357 if ((!attacks[WHITE][sq]) && (attacks[BLACK]))
01:E16E 88 703 control -= (mhold_black) * BC_FACTOR;
89 }
01:E179 90 4794 if (nearKingWhite.squareIsSet(sq)) {
91 // Same for white
01:E189 92 1665 if ((sqcontrol < 0) || ((sqcontrol == 0) &&
(position[sq] == NONE)))
01:E199 93 489 control += (mhold_black * BC_FACTOR *
(sqcontrol - 1));
01:E1A6 94 1359 if ((!attacks[BLACK][sq]) && (attacks[WHITE]))
01:E1B7 95 581 control += (mhold_white) * BC_FACTOR;
96 }
97 }
98
99
01:E1D9 100 3210 " addAttacks(WHITE, KING, kingSquare[WHITE]);"
01:E272 101 3101 " addAttacks(BLACK, KING, kingSquare[BLACK]);"
102
103
104 return (control);
105
106 }
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.