[gray-matter] r1618 committed - last few commits made engine weaker....

1 view
Skip to first unread message

codesite...@google.com

unread,
Aug 2, 2010, 10:58:56 PM8/2/10
to gray-matter-...@googlegroups.com
Revision: 1618
Author: protonspring
Date: Mon Aug 2 19:58:09 2010
Log: last few commits made engine weaker.
Revertin. .will try again.


http://code.google.com/p/gray-matter/source/detail?r=1618

Modified:
/trunk/inc/board_base.h
/trunk/inc/state.h
/trunk/src/board_base.cpp
/trunk/src/search_mtdf.cpp

=======================================
--- /trunk/inc/board_base.h Mon Aug 2 15:27:38 2010
+++ /trunk/inc/board_base.h Mon Aug 2 19:58:09 2010
@@ -39,18 +39,19 @@
class board_base
{
//precomputed single bit masks
- static bitboard_t BIT_MSK[8][8];
+ static bitboard_t singleBitMasks[8][8];

public:
- inline static int BIT_IDX(int x, int y) {return ((y << 3) | x);}
- inline static bool BIT_GET(bitboard_t b, int x, int y) {return
((b) >> BIT_IDX(x,y) & 1);}
- inline static void BIT_CLR(bitboard_t& b, unsigned x, unsigned y)
{(b) &= ~BIT_MSK[x][y];}
- inline static void BIT_SET(bitboard_t& b, int x, int y) {(b) |=
BIT_MSK[x][y];}
- inline static bitboard_t BIT_MOV(bitboard_t& b, int x1, int y1, int x2,
int y2) {return ((b) ^= BIT_MSK[x1][y1] | BIT_MSK[x2][y2]);}
+ inline static int BIT_IDX(int x, int y) {return ((y) << 3 |
(x));}
+ inline static bitboard_t BIT_MSK(int x, int y) {return
singleBitMasks[x][y];}
+ inline static bool BIT_GET(bitboard_t b, int x, int y) {return
((b) >> BIT_IDX(x, y) & 1);}
+ inline static void BIT_CLR(bitboard_t& b, unsigned x, unsigned y)
{(b) &= ~BIT_MSK(x, y);}
+ inline static void BIT_SET(bitboard_t& b, int x, int y) {(b) |=
BIT_MSK(x, y);}
+ inline static bitboard_t BIT_MOV(bitboard_t& b, int x1, int y1, int x2,
int y2) {return ((b) ^= BIT_MSK(x1, y1) | BIT_MSK(x2, y2));}

inline static int ROW_NUM(int x,int y,int a){return ((a) ==
ZERO ? (y) : (x));}
inline static int ROW_LOC(int x,int y,int a){return ((a) ==
ZERO ? (x) : 7 - (y));}
- inline static int ROW_IDX(int n){return (BIT_IDX(0,n));}
+ inline static int ROW_IDX(int n){return (BIT_IDX(0, n));}
inline static bitboard_t ROW_MSK(int n){return (0xFFULL << ROW_IDX(n));}
inline static bitrow_t ROW_GET(bitboard_t b, int n){return
((bitrow_t)((b) >> ROW_IDX(n) & 0xFF));}
inline static bitboard_t ROW_CLR(bitboard_t& b, int n){return ((b) &=
~ROW_MSK(n));}
@@ -58,14 +59,14 @@

// These macros manipulate columns in 0° rotated BitBoards and rows in
90°
// rotated BitBoards.
- inline static int COL_IDX(int n){return (BIT_IDX(n,0));}
+ inline static int COL_IDX(int n){return (BIT_IDX(n, 0));}
inline static bitboard_t COL_MSK(int n){return (0x0101010101010101ULL
<< COL_IDX(n));}
inline static bitboard_t COL_CLR(bitboard_t& b, int n){return ((b) &=
~COL_MSK(n));}

// These macros manipulate adjacent bits in 45° rotated BitBoards, which
// correspond to diagonals in 0° and 90° rotated BitBoards.
inline static int DIAG_NUM(int x, int y, int a){return ((a) ==
L45 ? (x) + (y) : 7 - (x) + (y));}
- inline static int DIAG_LOC(int x, int y, int a){return
(BIT_IDX(coord[MAP][a][x][y][X],coord[MAP][a][x][y][Y]) -
diag_index[DIAG_NUM(x, y, a)]);}
+ inline static int DIAG_LOC(int x, int y, int a){return
(BIT_IDX(coord[MAP][a][x][y][X], coord[MAP][a][x][y][Y]) -
diag_index[DIAG_NUM(x, y, a)]);}
inline static int DIAG_LEN(int n){return (8 - abs(7 - (n)));}
inline static int DIAG_IDX(int n){return (diag_index[n]);}
inline static bitboard_t DIAG_MSK(int n){return ((bitboard_t)
diag_mask[n] << diag_index[n]);}
=======================================
--- /trunk/inc/state.h Mon Aug 2 16:40:38 2010
+++ /trunk/inc/state.h Mon Aug 2 19:58:09 2010
@@ -43,7 +43,6 @@
int en_passant; ///< En passant vulnerability.
bool on_move; ///< Color on move.
int fifty; ///< 50 move rule counter.
- unsigned iNumPieces; ///< piece count
} state_t;

class stateArray
=======================================
--- /trunk/src/board_base.cpp Mon Aug 2 16:40:38 2010
+++ /trunk/src/board_base.cpp Mon Aug 2 19:58:09 2010
@@ -160,7 +160,7 @@
bitboard_t board_base::key_en_passant[8];
bitboard_t board_base::key_on_move;

-uint64_t board_base::BIT_MSK[8][8];
+uint64_t board_base::singleBitMasks[8][8];


/*----------------------------------------------------------------------------*\
|
board_base() |
@@ -171,12 +171,10 @@
/// Constructor. Important! Seed the random number generator, issue
/// <code>srand(time(NULL));</code> before instantiating this class!

- //compute some useful arrays
+ //compute single bit masks
for (int i=0;i<8;++i)
for (int j=0;j<8;++j)
- {
- BIT_MSK[j][i] = 1ULL << (i*8+j);
- }
+ singleBitMasks[j][i] = 1ULL << (i*8+j);

if (!precomputed_board_base)
{
@@ -386,9 +384,6 @@
if (!no_move_counts && ++index >= fen.length())
return set_board_fen_error(fen, "FEN string too short (12).", x,
y);

- //update iNumPieces so we know when to check for insufficient
- state.iNumPieces = get_num_pieces(BLACK) + get_num_pieces(WHITE);
-
init_rotation();
init_hash();

@@ -496,8 +491,12 @@
if (!state.piece[WHITE][KING] || !state.piece[BLACK][KING])
return ILLEGAL;

+ // Are the kings attacking one other?
+ //int n = FST(state.piece[WHITE][KING]);
+ //if (squares_king[n & 0x7][n >> 3] & state.piece[BLACK][KING])
+ //return ILLEGAL;
+
//if the king on move is in check, then this position is illegal
- // This also covers if the kings attacking one other? maybe?
if (check(state.piece[OFF_MOVE][KING], ON_MOVE))
return ILLEGAL;

@@ -507,11 +506,8 @@
case STALEMATE: return STALEMATE;
case CHECKMATE: return CHECKMATE;
}
- if (state.iNumPieces < 5)
- {
- if (insufficient())
+ if (insufficient())
return INSUFFICIENT;
- }
if (three())
return THREE;
if (fifty())
@@ -717,7 +713,6 @@
// The move is a capture. Reset the 50 move rule counter.
state.fifty = -1;
retValue = true;
- state.iNumPieces--;
}
}

@@ -732,7 +727,7 @@
// If we're moving a piece to one of our opponent's rooks' initial
// positions, then make sure that our opponent is no longer marked
able to
// castle on that rook's side.
- if ((m.x2 == 0 || m.x2 == 7) && (m.y2 == (OFF_MOVE ? 7 : 0)))
+ if ((m.x2 == 0 || m.x2 == 7) && (m.y2 == (OFF_MOVE ? 7 : 0)) &&
state.castle[OFF_MOVE][m.x2 == 7] == CAN_CASTLE)
{
state.castle[OFF_MOVE][m.x2 == 7] = CANT_CASTLE;
hash ^= key_castle[OFF_MOVE][m.x1 == 7][CANT_CASTLE];
@@ -761,7 +756,7 @@
// At this point, we've moved the king. Make sure that we're no
longer
// marked able to castle on either side.
for (int side = QUEEN_SIDE; side <= KING_SIDE; side++)
- //if (state.castle[ON_MOVE][side] == CAN_CASTLE) //WHY?
+ if (state.castle[ON_MOVE][side] == CAN_CASTLE)
{
state.castle[ON_MOVE][side] = CANT_CASTLE;
hash ^= key_castle[ON_MOVE][side][CANT_CASTLE];
@@ -791,13 +786,11 @@
BIT_CLR(rotation[angle][OFF_MOVE],
coord[MAP][angle][m.x2][m.y1][X], coord[MAP][angle][m.x2][m.y1][Y]);
hash ^= key_piece[OFF_MOVE][PAWN][m.x2][m.y1];
pawn_hash ^= key_piece[OFF_MOVE][PAWN][m.x2][m.y1];
- state.iNumPieces--;
- }
+ }

// If we're advancing a pawn two squares, then mark it
vulnerable to en
// passant.
state.en_passant = abs((int) m.y1 - (int) m.y2) == 2 ? (int)
m.x1 : -1;
-
}
else
// Oops. We're not moving a pawn. Mark no pawn vulnerable to en
@@ -1241,7 +1234,6 @@
state.en_passant = -1;
state.on_move = WHITE;
state.fifty = 0;
- state.iNumPieces = 32;
}


/*----------------------------------------------------------------------------*\
=======================================
--- /trunk/src/search_mtdf.cpp Mon Aug 2 16:40:38 2010
+++ /trunk/src/search_mtdf.cpp Mon Aug 2 19:58:09 2010
@@ -463,8 +463,8 @@
//if we didn't hit the timeout flag, then this position is
//a terminal one, store it with max depth so we always return
//it on a hash table probe (we'll never want to explore deeper).
- if (!timeout_flag)
- table_ptr->store(hash, MAX_DEPTH, EXACT, m);
+ //if (!timeout_flag)
+ //table_ptr->store(hash, max_depth-depth, EXACT, m);
#ifndef _MSDEV_WINDOWS
DEBUG_SEARCH_PRINT("%s.", m.value == VALUE_ILLEGAL ? "Illegal
position" : m.value == VALUE_CONTEMPT ? "Stalemated" : "Checkmated");
#endif
@@ -475,11 +475,13 @@
if (!timeout_flag)
{
// Nope, the results are complete and reliable. Save them for
progeny.
- //if (m.value > saved_alpha && m.value < saved_beta)
- //{
- // When doing MTD(f) zero-window searches, our move search should
- // never return an exact score. I've only accounted for this in
the
- // interest of robustness.
+ if (m.value > saved_alpha && m.value < saved_beta)
+ {
+ // When doing MTD(f) zero-window searches, our move search
should
+ // never return an exact score. I've only accounted for this
in the
+ // interest of robustness.
+ //if ((max_depth-depth) > 3)
+ //table_ptr->store(hash, max_depth-depth-1, EXACT, m);
if (depth < max_depth) //no special branches
table_ptr->store(hash, max_depth-depth,EXACT,m);
//else if (m.value <= saved_alpha)
@@ -488,7 +490,7 @@
//else // m.value >= saved_beta
//{
//table_ptr->store(hash, max_depth-depth, LOWER, m);
- //}
+ }
history_ptr->store(whose, m); //this seems like a good move
}

Reply all
Reply to author
Forward
0 new messages