AttackSpanMask[c][s] = in_front_bb(c, s) & neighboring_files_bb(s);
}
- for (Bitboard b = 0ULL; b < 256ULL; b++)
+ for (Bitboard b = 0; b < 256; b++)
BitCount8Bit[b] = (uint8_t)count_1s<CNT32>(b);
}
for (int i = 0, index = 0; i < 64; i++)
{
attackIndex[i] = index;
- mask[i] = sliding_attacks(i, 0ULL, 4, deltas, 1, 6, 1, 6);
+ mask[i] = sliding_attacks(i, 0, 4, deltas, 1, 6, 1, 6);
#if defined(IS_64BIT)
int j = (1 << (64 - shift[i]));
if (!bookMove)
return MOVE_NONE;
- MoveStack mlist[256];
+ MoveStack mlist[MOVES_MAX];
MoveStack* last = generate_moves(pos, mlist);
for (MoveStack* cur = mlist; cur != last; cur++)
if ((int(cur->move) & 07777) == bookMove)
read(buf, size);
// Numbers are stored on disk as a binary byte stream
- uint64_t n = 0ULL;
+ uint64_t n = 0;
for (int i = 0; i < size; i++)
n = (n << 8) + (unsigned char)buf[i];
uint64_t book_key(const Position& pos) {
- uint64_t result = 0ULL;
+ uint64_t result = 0;
for (Color c = WHITE; c <= BLACK; c++)
{
uint64_t book_castle_key(const Position& pos) {
- uint64_t result = 0ULL;
+ uint64_t result = 0;
if (pos.can_castle_kingside(WHITE))
result ^= Random64[RandomCastle+0];
uint64_t book_ep_key(const Position& pos) {
- return (pos.ep_square() == SQ_NONE ? 0ULL : Random64[RandomEnPassant + square_file(pos.ep_square())]);
+ return pos.ep_square() == SQ_NONE ? 0 : Random64[RandomEnPassant + square_file(pos.ep_square())];
}
uint64_t book_color_key(const Position& pos) {
- return (pos.side_to_move() == WHITE ? Random64[RandomTurn] : 0ULL);
+ return pos.side_to_move() == WHITE ? Random64[RandomTurn] : 0;
}
}
#include "piece.h"
#include "square.h"
+// Maximum number of allowed moves per position
+const int MOVES_MAX = 256;
////
//// Types
bool move_is_legal(const Position& pos, const Move m) {
- MoveStack mlist[256];
+ MoveStack mlist[MOVES_MAX];
MoveStack *cur, *last = generate_moves(pos, mlist, true);
for (cur = mlist; cur != last; cur++)
int searchTT = ttm;
ttMoves[0].move = ttm;
badCaptureThreshold = 0;
- badCaptures = moves + 256;
+ badCaptures = moves + MOVES_MAX;
pinned = p.pinned_pieces(pos.side_to_move());
// Bad captures SEE value is already calculated so just pick
// them in order to get SEE move ordering.
curMove = badCaptures;
- lastMove = moves + 256;
+ lastMove = moves + MOVES_MAX;
return;
case PH_EVASIONS:
int badCaptureThreshold, phase;
const uint8_t* phasePtr;
MoveStack *curMove, *lastMove, *lastGoodNonCapture, *badCaptures;
- MoveStack moves[256];
+ MoveStack moves[MOVES_MAX];
};
/// Position::print() prints an ASCII representation of the position to
-/// the standard output. If a move is given then also the san is print.
+/// the standard output. If a move is given then also the san is printed.
void Position::print(Move move) const {
Key Position::compute_key() const {
- Key result = Key(0ULL);
+ Key result = 0;
for (Square s = SQ_A1; s <= SQ_H8; s++)
if (square_is_occupied(s))
Key Position::compute_pawn_key() const {
- Key result = Key(0ULL);
+ Key result = 0;
Bitboard b;
Square s;
Key Position::compute_material_key() const {
- Key result = Key(0ULL);
+ Key result = 0;
for (Color c = WHITE; c <= BLACK; c++)
for (PieceType pt = PAWN; pt <= QUEEN; pt++)
{
bool Position::is_mate() const {
- MoveStack moves[256];
+ MoveStack moves[MOVES_MAX];
return is_check() && (generate_moves(*this, moves) == moves);
}
bool Position::has_mate_threat() {
- MoveStack mlist[256], *last, *cur;
+ MoveStack mlist[MOVES_MAX], *last, *cur;
StateInfo st1, st2;
bool mateFound = false;
namespace {
- // Maximum number of allowed moves per position
- const int MOVES_MAX = 256;
-
// Types
enum NodeType { NonPV, PV };
// Add some extra time if the best move has changed during the last two iterations
if (Iteration > 5 && Iteration <= 50)
- TimeMgr.pv_unstability(BestMoveChangesByIteration[Iteration],
+ TimeMgr.pv_instability(BestMoveChangesByIteration[Iteration],
BestMoveChangesByIteration[Iteration-1]);
// Stop search if most of MaxSearchTime is consumed at the end of the
//// Functions
////
-void TimeManager::pv_unstability(int curChanges, int prevChanges) {
+void TimeManager::pv_instability(int curChanges, int prevChanges) {
unstablePVExtraTime = curChanges * (optimumSearchTime / 2)
+ prevChanges * (optimumSearchTime / 3);
public:
void init(int myTime, int myInc, int movesToGo, int currentPly);
- void pv_unstability(int curChanges, int prevChanges);
+ void pv_instability(int curChanges, int prevChanges);
int available_time() const { return optimumSearchTime + unstablePVExtraTime; }
int maximum_time() const { return maximumSearchTime; }