Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changes.

  • Loading branch information...
commit 87b5a558bde34227937233078ba98083a60e2490 1 parent 74f3bdc
@Bobcat authored
View
4 src/Bobcat.h
@@ -152,10 +152,10 @@ class Bobcat : public ProtocolListener {
output = new StdOut(logger);
protocol = new UCIProtocol(this, game, input, output);
book = new Book(config, logger);
+ transt = new TranspositionTable(256);
pawnt = new PawnStructureTable(8);
- eval = new Eval(game, pawnt);
see = new SEE(game);
- transt = new TranspositionTable(256);
+ eval = new Eval(game, pawnt, see);
search = new Search(protocol, game, eval, see, transt);
newGame();
View
30 src/Eval.h
@@ -18,8 +18,8 @@
class Eval {
public:
- Eval(Game* game, PawnStructureTable* pawnt) {
- initialise(game, pawnt);
+ Eval(Game* game, PawnStructureTable* pawnt, SEE* see) {
+ initialise(game, pawnt, see);
}
virtual void newGame() {
@@ -291,10 +291,26 @@ class Eval {
int score_mg = rr*4;
int score_eg = rr*3;
- score_eg += rr*(front_span & board->occupied_by_side[side] ? 0 : 1);
- score_eg += rr*(front_span & board->occupied_by_side[side ^ 1] ? 0 : 1);
- score_eg += rr*(front_span & all_attacks[side ^ 1] ? 0 : 1);
+ bool unblocked_them = (front_span & board->occupied_by_side[side ^ 1]) == 0;
+ bool unattacked = (front_span & all_attacks[side ^ 1]) == 0;
+ if (unblocked_them) {
+ score_eg += rr;
+ }
+ if (unattacked) {
+ score_eg += rr;
+ }
+
+ bool unblocked_us = (front_span & board->occupied_by_side[side]) == 0;
+ bool defended = (front_span & all_attacks[side]) == front_span;
+
+ if (unblocked_us) {
+ score_eg += rr;
+ }
+ if (defended) {
+ score_eg += rr;
+ }
+
score_eg += r*(distance[sq][kingSq(side ^ 1)]*2-distance[sq][kingSq(side)]*2);
poseval_mg[side] += score_mg;
@@ -340,10 +356,11 @@ class Eval {
all_attacks[1] = pawn_attacks[1] = pawnEastAttacks[1](pawns(1)) | pawnWestAttacks[1](pawns(1));
}
- void initialise(Game* game, PawnStructureTable* pawnt) {
+ void initialise(Game* game, PawnStructureTable* pawnt, SEE* see) {
this->game = game;
board = game->pos->board;
this->pawnt = pawnt;
+ this->see = see;
pawns_array[0] = &board->pawns(0);
pawns_array[1] = &board->pawns(1);
king_square[0] = &board->king_square[0];
@@ -354,6 +371,7 @@ class Eval {
Position* pos;
Game* game;
PawnStructureTable* pawnt;
+ SEE* see;
PawnEntry* pawnp;
int poseval_mg[2];
View
4 src/Material.h
@@ -68,6 +68,10 @@ class Material {
return key[c] == (key[c] & 15);
}
+ __forceinline bool isKx() {
+ return isKx(0) && isKx(1);
+ }
+
__forceinline int value() {
return material_value[0] + material_value[1];
}
View
3  src/Moves.h
@@ -184,8 +184,7 @@ class Moves {
addCastleMove(ooo_king_from[side_to_move], ooo_king_to[side_to_move]);
}
}
- const BB& pawns = board->pawns(side_to_move);
- BB pushed = pawnPush[side_to_move](pawns & ~rank_7[side_to_move]) & ~occupied;
+ BB pushed = pawnPush[side_to_move](board->pawns(side_to_move) & ~rank_7[side_to_move]) & ~occupied;
addPawnMoves(pushed, pawn_push_dist, QUIET);
addPawnMoves(pawnPush[side_to_move](pushed & rank_3[side_to_move]) & ~occupied, pawn_double_push_dist, DOUBLEPUSH);
addMoves(~occupied);
View
13 src/Search.h
@@ -120,8 +120,8 @@ class Search : public Runnable, public MoveSorter {
if (makeMove(m)) {
Depth next_depth = getNextDepth(true, depth, ++move_count, move_data);
- if (search_depth > 10*one_ply && search_time > 5000 || (isAnalysing() && search_depth>10)) {
- if (protocol) protocol->postInfo(m, move_count);
+ if (search_depth > 10*one_ply && (search_time > 5000 || isAnalysing()) && protocol) {
+ protocol->postInfo(m, move_count);
}
Score score;
@@ -325,19 +325,16 @@ class Search : public Runnable, public MoveSorter {
__forceinline Depth getNextDepth(bool is_pv_node, const Depth depth, const int move_count,
const MoveData* move_data) const
{
- if (pos->in_check) {
- return is_pv_node ? depth : depth - one_ply;
- }
// singular move extension is a way to find the mate in 9 in: fen 3r1r2/pppb1p1k/2npqP1p/2b1p3/8/2NP2PP/PPPQN1BK/R4R2 w - - 0 1
// should be possible without + better eval
- if ((pos-1)->in_check && (pos-1)->moveCount() == 1) {
- return is_pv_node ? depth : depth - one_ply;
+ if (pos->in_check || ((pos-1)->in_check && (pos-1)->moveCount() == 1)) {
+ return (is_pv_node || move_count < 3) ? depth : depth - one_ply;
}
const Move m = move_data->move;
if (!isPassedPawnMove(m)
&& !isQueenPromotion(m)
&& !isCapture(m)
- && move_count >= 5)
+ && move_count >= 5)
{
return depth - 2*one_ply - (depth/16)*one_ply - (max(0, (move_count-6)/12))*one_ply;
}
View
5 src/See.h
@@ -41,6 +41,11 @@ class SEE {
return seeRec(materialChange(move), nextToCapture(move), moveTo(move), side(move) ^ 1);
}
+ int seeSquare(const Square sq) {
+ initialiseSeeMove();
+ //return seeRec(0, pawn moveTo(move), side(move) ^ 1);
+ }
+
private:
__forceinline int materialChange(const Move move) {
return (isCapture(move) ? piece_value(moveCaptured(move)) : 0) + (isPromotion(move) ?
View
2  src/Worker.h
@@ -22,7 +22,7 @@ class Worker {
game = new Game(config);
game->copy(master);
see = new SEE(game);
- eval = new Eval(game, pawnt);
+ eval = new Eval(game, pawnt, see);
search = new Search(game, eval, see, transt);
thread = new Thread(search);
thread->start();
Please sign in to comment.
Something went wrong with that request. Please try again.