const std::string Bitboards::pretty(Bitboard b) {
- std::string s = "+---+---+---+---+---+---+---+---+\n";
+ std::string s = "+---+---+---+---+---+---+---+---+---+---+---+---+\n";
- for (Rank r = RANK_8; r >= RANK_1; --r)
+ for (Rank r = RANK_MAX; r >= RANK_1; --r)
{
- for (File f = FILE_A; f <= FILE_H; ++f)
+ for (File f = FILE_A; f <= FILE_MAX; ++f)
s += b & make_square(f, r) ? "| X " : "| ";
- s += "|\n+---+---+---+---+---+---+---+---+---+---+---+---+\n";
- s += "| " + std::to_string(1 + r) + "\n+---+---+---+---+---+---+---+---+\n";
++ s += "| " + std::to_string(1 + r) + "\n+---+---+---+---+---+---+---+---+---+---+---+---+\n";
}
- s += " a b c d e f g h\n";
++ s += " a b c d e f g h i j k\n";
return s;
}
+ 24 * infiltration
+ 51 * !pos.non_pawn_material()
- 43 * almostUnwinnable
- - 2 * pos.rule50_count()
-110 ;
+ }
Value mg = mg_value(score);
Value eg = eg_value(score);
Trace::add(MOBILITY, mobility[WHITE], mobility[BLACK]);
}
+ // Evaluation grain
+ v = (v / 16) * 16;
+
// Side to move point of view
- return (pos.side_to_move() == WHITE ? v : -v) + Eval::tempo_value(pos);
- v = (pos.side_to_move() == WHITE ? v : -v) + Tempo;
++ v = (pos.side_to_move() == WHITE ? v : -v) + Eval::tempo_value(pos);
+
+ // Damp down the evaluation linearly when shuffling
- v = v * (100 - pos.rule50_count()) / 100;
++ if (pos.n_move_rule())
++ v = v * (2 * pos.n_move_rule() - pos.rule50_count()) / (2 * pos.n_move_rule());
+
+ return v;
}
} // namespace
std::ostream& operator<<(std::ostream& os, const Position& pos) {
- os << "\n +---+---+---+---+---+---+---+---+\n";
+ os << "\n ";
+ for (File f = FILE_A; f <= pos.max_file(); ++f)
+ os << "+---";
+ os << "+\n";
- for (Rank r = RANK_8; r >= RANK_1; --r)
+ for (Rank r = pos.max_rank(); r >= RANK_1; --r)
{
- for (File f = FILE_A; f <= FILE_H; ++f)
- os << " | " << PieceToChar[pos.piece_on(make_square(f, r))];
-
- os << " | " << (1 + r) << "\n +---+---+---+---+---+---+---+---+\n";
+ for (File f = FILE_A; f <= pos.max_file(); ++f)
+ if (pos.unpromoted_piece_on(make_square(f, r)))
+ os << " |+" << pos.piece_to_char()[pos.unpromoted_piece_on(make_square(f, r))];
+ else
+ os << " | " << pos.piece_to_char()[pos.piece_on(make_square(f, r))];
+
- os << " |";
++ os << " |" << (1 + r);
+ if (r == pos.max_rank() || r == RANK_1)
+ {
+ Color c = r == RANK_1 ? WHITE : BLACK;
+ if (c == pos.side_to_move())
+ os << " *";
+ else
+ os << " ";
+ if (pos.piece_drops() || pos.seirawan_gating() || pos.arrow_gating())
+ {
+ os << " [";
+ for (PieceType pt = KING; pt >= PAWN; --pt)
+ os << std::string(pos.count_in_hand(c, pt), pos.piece_to_char()[make_piece(c, pt)]);
+ os << "]";
+ }
+ }
+ os << "\n ";
+ for (File f = FILE_A; f <= pos.max_file(); ++f)
+ os << "+---";
+ os << "+\n";
}
- os << " a b c d e f g h\n"
- << "\nFen: " << pos.fen() << "\nKey: " << std::hex << std::uppercase
++ for (File f = FILE_A; f <= pos.max_file(); ++f)
++ os << " " << char('a' + f);
++ os << "\n";
+ os << "\nFen: " << pos.fen() << "\nSfen: " << pos.fen(true) << "\nKey: " << std::hex << std::uppercase
<< std::setfill('0') << std::setw(16) << pos.key()
<< std::setfill(' ') << std::dec << "\nCheckers: ";
// Futility pruning: parent node (~5 Elo)
if ( lmrDepth < 6
&& !ss->inCheck
- && ss->staticEval + 235 + 172 * lmrDepth <= alpha
- && (*contHist[0])[movedPiece][to_sq(move)]
- + (*contHist[1])[movedPiece][to_sq(move)]
- + (*contHist[3])[movedPiece][to_sq(move)]
- + (*contHist[5])[movedPiece][to_sq(move)] / 2 < 31400)
+ && !( pos.extinction_value() == -VALUE_MATE
+ && pos.extinction_piece_types().find(ALL_PIECES) == pos.extinction_piece_types().end())
+ && ss->staticEval + (235 + 172 * lmrDepth) * (1 + pos.check_counting()) <= alpha
+ && (*contHist[0])[history_slot(movedPiece)][to_sq(move)]
+ + (*contHist[1])[history_slot(movedPiece)][to_sq(move)]
- + (*contHist[3])[history_slot(movedPiece)][to_sq(move)] < 27400)
++ + (*contHist[3])[history_slot(movedPiece)][to_sq(move)]
++ + (*contHist[5])[history_slot(movedPiece)][to_sq(move)] / 2 < 31400)
continue;
// Prune moves with negative SEE (~20 Elo)
class TranspositionTable {
- static constexpr int ClusterSize = 3;
+ static constexpr int ClusterSize = 5;
+ static constexpr int ClustersPerSuperCluster = 256;
struct Cluster {
TTEntry entry[ClusterSize];
void init(OptionsMap& o) {
- // at most 2^32 clusters.
- constexpr int MaxHashMB = Is64Bit ? 131072 : 2048;
+ // At most 2^32 superclusters. Supercluster = 8 kB
+ constexpr int MaxHashMB = Is64Bit ? 33554432 : 2048;
+ o["Protocol"] << Option("uci", {"uci", "usi", "ucci", "xboard"});
o["Debug Log File"] << Option("", on_logger);
o["Contempt"] << Option(24, -100, 100);
- o["Analysis Contempt"] << Option("Both var Off var White var Black var Both", "Both");
+ o["Analysis Contempt"] << Option("Both", {"Both", "Off", "White", "Black"});
o["Threads"] << Option(1, 1, 512, on_threads);
o["Hash"] << Option(16, 1, MaxHashMB, on_hash_size);
o["Clear Hash"] << Option(on_clear_hash);