#include "tt.h"
#include "ucioption.h"
-using std::cout;
-using std::endl;
-using std::string;
-using Search::Signals;
-using Search::Limits;
-
namespace Search {
volatile SignalsType Signals;
Position RootPosition;
}
+using std::cout;
+using std::endl;
+using std::string;
+using namespace Search;
+
namespace {
// Set to true to force running with one thread. Used for debugging
Move id_loop(Position& pos, Move rootMoves[], Move* ponderMove);
template <NodeType NT>
- Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth);
+ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth);
template <NodeType NT>
- Value qsearch(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth);
+ Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth);
bool check_is_dangerous(Position &pos, Move move, Value futilityBase, Value beta, Value *bValue);
bool connected_moves(const Position& pos, Move m1, Move m2);
// we simply create and use a standard MovePicker object.
template<bool SpNode> struct MovePickerExt : public MovePicker {
- MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss, Value b)
+ MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, Stack* ss, Value b)
: MovePicker(p, ttm, d, h, ss, b) {}
};
// In case of a SpNode we use split point's shared MovePicker object as moves source
template<> struct MovePickerExt<true> : public MovePicker {
- MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, SearchStack* ss, Value b)
+ MovePickerExt(const Position& p, Move ttm, Depth d, const History& h, Stack* ss, Value b)
: MovePicker(p, ttm, d, h, ss, b), mp(ss->sp->mp) {}
Move get_next_move() { return mp->get_next_move(); }
Move id_loop(Position& pos, Move rootMoves[], Move* ponderMove) {
- SearchStack ss[PLY_MAX_PLUS_2];
+ Stack ss[PLY_MAX_PLUS_2];
Value bestValues[PLY_MAX_PLUS_2];
int bestMoveChanges[PLY_MAX_PLUS_2];
int depth, aspirationDelta;
bool bestMoveNeverChanged = true;
// Initialize stuff before a new search
- memset(ss, 0, 4 * sizeof(SearchStack));
+ memset(ss, 0, 4 * sizeof(Stack));
TT.new_search();
H.clear();
*ponderMove = bestMove = skillBest = skillPonder = MOVE_NONE;
// here: This is taken care of after we return from the split point.
template <NodeType NT>
- Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth) {
+ Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {
const bool PvNode = (NT == PV || NT == Root || NT == SplitPointPV || NT == SplitPointRoot);
const bool SpNode = (NT == SplitPointPV || NT == SplitPointNonPV || NT == SplitPointRoot);
// less than ONE_PLY).
template <NodeType NT>
- Value qsearch(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth) {
+ Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {
const bool PvNode = (NT == PV);
assert(!do_terminate);
// Copy split point position and search stack and call search()
- SearchStack ss[PLY_MAX_PLUS_2];
+ Stack ss[PLY_MAX_PLUS_2];
SplitPoint* tsp = splitPoint;
Position pos(*tsp->pos, threadID);
- memcpy(ss, tsp->ss - 1, 4 * sizeof(SearchStack));
+ memcpy(ss, tsp->ss - 1, 4 * sizeof(Stack));
(ss+1)->sp = tsp;
if (tsp->nodeType == Root)