mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Convert History table H in a local variable
This is a first step for future patches and in any case seems a nice thing to do. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
e1ed67aacb
commit
c1b60269a2
5 changed files with 14 additions and 12 deletions
|
@ -63,7 +63,8 @@ namespace {
|
||||||
/// search captures, promotions and some checks) and about how important good
|
/// search captures, promotions and some checks) and about how important good
|
||||||
/// move ordering is at the current node.
|
/// move ordering is at the current node.
|
||||||
|
|
||||||
MovePicker::MovePicker(const Position& p, bool pv, Move ttm, Depth d, SearchStack* ss) : pos(p) {
|
MovePicker::MovePicker(const Position& p, bool pv, Move ttm, Depth d,
|
||||||
|
const History& h, SearchStack* ss) : pos(p), H(h) {
|
||||||
|
|
||||||
pvNode = pv;
|
pvNode = pv;
|
||||||
ttMove = ttm;
|
ttMove = ttm;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
////
|
////
|
||||||
|
|
||||||
#include "depth.h"
|
#include "depth.h"
|
||||||
|
#include "history.h"
|
||||||
#include "lock.h"
|
#include "lock.h"
|
||||||
#include "position.h"
|
#include "position.h"
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ public:
|
||||||
PH_STOP
|
PH_STOP
|
||||||
};
|
};
|
||||||
|
|
||||||
MovePicker(const Position& p, bool pvnode, Move ttm, Depth d, SearchStack* ss = NULL);
|
MovePicker(const Position& p, bool pvnode, Move ttm, Depth d, const History& h, SearchStack* ss = NULL);
|
||||||
Move get_next_move();
|
Move get_next_move();
|
||||||
Move get_next_move(Lock& lock);
|
Move get_next_move(Lock& lock);
|
||||||
int number_of_moves() const;
|
int number_of_moves() const;
|
||||||
|
@ -80,6 +81,7 @@ private:
|
||||||
Move pick_move_from_list();
|
Move pick_move_from_list();
|
||||||
|
|
||||||
const Position& pos;
|
const Position& pos;
|
||||||
|
const History& H;
|
||||||
Move ttMove, mateKiller, killer1, killer2;
|
Move ttMove, mateKiller, killer1, killer2;
|
||||||
Bitboard pinned, dc;
|
Bitboard pinned, dc;
|
||||||
MoveStack moves[256], badCaptures[64];
|
MoveStack moves[256], badCaptures[64];
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "history.h"
|
||||||
#include "movepick.h"
|
#include "movepick.h"
|
||||||
#include "san.h"
|
#include "san.h"
|
||||||
|
|
||||||
|
@ -143,7 +144,7 @@ Move move_from_san(const Position& pos, const string& movestr) {
|
||||||
|
|
||||||
assert(pos.is_ok());
|
assert(pos.is_ok());
|
||||||
|
|
||||||
MovePicker mp = MovePicker(pos, false, MOVE_NONE, OnePly);
|
MovePicker mp = MovePicker(pos, false, MOVE_NONE, OnePly, History());
|
||||||
|
|
||||||
// Castling moves
|
// Castling moves
|
||||||
if (movestr == "O-O-O" || movestr == "O-O-O+")
|
if (movestr == "O-O-O" || movestr == "O-O-O+")
|
||||||
|
@ -367,7 +368,7 @@ namespace {
|
||||||
if (type_of_piece(pc) == KING)
|
if (type_of_piece(pc) == KING)
|
||||||
return AMBIGUITY_NONE;
|
return AMBIGUITY_NONE;
|
||||||
|
|
||||||
MovePicker mp = MovePicker(pos, false, MOVE_NONE, OnePly);
|
MovePicker mp = MovePicker(pos, false, MOVE_NONE, OnePly, History());
|
||||||
Move mv, moveList[8];
|
Move mv, moveList[8];
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
|
@ -207,6 +207,9 @@ namespace {
|
||||||
// Search depth at iteration 1
|
// Search depth at iteration 1
|
||||||
const Depth InitialDepth = OnePly /*+ OnePly/2*/;
|
const Depth InitialDepth = OnePly /*+ OnePly/2*/;
|
||||||
|
|
||||||
|
// History tables
|
||||||
|
History H;
|
||||||
|
|
||||||
// Node counters
|
// Node counters
|
||||||
int NodesSincePoll;
|
int NodesSincePoll;
|
||||||
int NodesBetweenPolls = 30000;
|
int NodesBetweenPolls = 30000;
|
||||||
|
@ -330,8 +333,6 @@ int ActiveThreads = 1;
|
||||||
// but it could turn out to be useful for debugging.
|
// but it could turn out to be useful for debugging.
|
||||||
Lock IOLock;
|
Lock IOLock;
|
||||||
|
|
||||||
History H; // Should be made local?
|
|
||||||
|
|
||||||
|
|
||||||
// SearchStack::init() initializes a search stack. Used at the beginning of a
|
// SearchStack::init() initializes a search stack. Used at the beginning of a
|
||||||
// new search from the root.
|
// new search from the root.
|
||||||
|
@ -1056,7 +1057,7 @@ namespace {
|
||||||
|
|
||||||
// Initialize a MovePicker object for the current position, and prepare
|
// Initialize a MovePicker object for the current position, and prepare
|
||||||
// to search all moves
|
// to search all moves
|
||||||
MovePicker mp = MovePicker(pos, true, ttMove, depth, &ss[ply]);
|
MovePicker mp = MovePicker(pos, true, ttMove, depth, H, &ss[ply]);
|
||||||
|
|
||||||
Move move, movesSearched[256];
|
Move move, movesSearched[256];
|
||||||
int moveCount = 0;
|
int moveCount = 0;
|
||||||
|
@ -1317,7 +1318,7 @@ namespace {
|
||||||
|
|
||||||
// Initialize a MovePicker object for the current position, and prepare
|
// Initialize a MovePicker object for the current position, and prepare
|
||||||
// to search all moves:
|
// to search all moves:
|
||||||
MovePicker mp = MovePicker(pos, false, ttMove, depth, &ss[ply]);
|
MovePicker mp = MovePicker(pos, false, ttMove, depth, H, &ss[ply]);
|
||||||
|
|
||||||
Move move, movesSearched[256];
|
Move move, movesSearched[256];
|
||||||
int moveCount = 0;
|
int moveCount = 0;
|
||||||
|
@ -1538,7 +1539,7 @@ namespace {
|
||||||
// Initialize a MovePicker object for the current position, and prepare
|
// Initialize a MovePicker object for the current position, and prepare
|
||||||
// to search the moves. Because the depth is <= 0 here, only captures,
|
// to search the moves. Because the depth is <= 0 here, only captures,
|
||||||
// queen promotions and checks (only if depth == 0) will be generated.
|
// queen promotions and checks (only if depth == 0) will be generated.
|
||||||
MovePicker mp = MovePicker(pos, pvNode, ttMove, depth);
|
MovePicker mp = MovePicker(pos, pvNode, ttMove, depth, H);
|
||||||
Move move;
|
Move move;
|
||||||
int moveCount = 0;
|
int moveCount = 0;
|
||||||
Bitboard dcCandidates = mp.discovered_check_candidates();
|
Bitboard dcCandidates = mp.discovered_check_candidates();
|
||||||
|
|
|
@ -73,9 +73,6 @@ extern TranspositionTable TT;
|
||||||
extern int ActiveThreads;
|
extern int ActiveThreads;
|
||||||
extern Lock SMPLock;
|
extern Lock SMPLock;
|
||||||
|
|
||||||
// Perhaps better to make H local, and pass as parameter to MovePicker?
|
|
||||||
extern History H;
|
|
||||||
|
|
||||||
|
|
||||||
////
|
////
|
||||||
//// Prototypes
|
//// Prototypes
|
||||||
|
|
Loading…
Add table
Reference in a new issue