summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
92e759a)
Serialize access to std::cout all over the code.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
#include "bitboard.h"
#include "bitcount.h"
#include "bitboard.h"
#include "bitcount.h"
#include "rkiss.h"
CACHE_LINE_ALIGNMENT
#include "rkiss.h"
CACHE_LINE_ALIGNMENT
void Bitboards::print(Bitboard b) {
void Bitboards::print(Bitboard b) {
for (Rank rank = RANK_8; rank >= RANK_1; rank--)
{
std::cout << "+---+---+---+---+---+---+---+---+" << '\n';
for (Rank rank = RANK_8; rank >= RANK_1; rank--)
{
std::cout << "+---+---+---+---+---+---+---+---+" << '\n';
- std::cout << "+---+---+---+---+---+---+---+---+" << std::endl;
+ std::cout << "+---+---+---+---+---+---+---+---+" << sync_endl;
string brd = twoRows + twoRows + twoRows + twoRows + dottedLine;
string brd = twoRows + twoRows + twoRows + twoRows + dottedLine;
if (move)
{
Position p(*this);
if (move)
{
Position p(*this);
if (piece_on(sq) != NO_PIECE)
brd[513 - 68*rank_of(sq) + 4*file_of(sq)] = PieceToChar[piece_on(sq)];
if (piece_on(sq) != NO_PIECE)
brd[513 - 68*rank_of(sq) + 4*file_of(sq)] = PieceToChar[piece_on(sq)];
- cout << brd << "\nFen is: " << to_fen() << "\nKey is: " << st->key << endl;
+ cout << brd << "\nFen is: " << to_fen() << "\nKey is: " << st->key << sync_endl;
-using std::cout;
-using std::endl;
using Eval::evaluate;
using namespace Search;
using Eval::evaluate;
using namespace Search;
- cout << "info depth 0 score "
- << score_to_uci(pos.in_check() ? -VALUE_MATE : VALUE_DRAW) << endl;
+ sync_cout << "info depth 0 score "
+ << score_to_uci(pos.in_check() ? -VALUE_MATE : VALUE_DRAW) << sync_endl;
RootMoves.push_back(MOVE_NONE);
goto finalize;
RootMoves.push_back(MOVE_NONE);
goto finalize;
<< " time: " << Limits.time[pos.side_to_move()]
<< " increment: " << Limits.inc[pos.side_to_move()]
<< " moves to go: " << Limits.movestogo
<< " time: " << Limits.time[pos.side_to_move()]
<< " increment: " << Limits.inc[pos.side_to_move()]
<< " moves to go: " << Limits.movestogo
StateInfo st;
pos.do_move(RootMoves[0].pv[0], st);
StateInfo st;
pos.do_move(RootMoves[0].pv[0], st);
- log << "\nPonder move: " << move_to_san(pos, RootMoves[0].pv[1]) << endl;
+ log << "\nPonder move: " << move_to_san(pos, RootMoves[0].pv[1]) << std::endl;
pos.undo_move(RootMoves[0].pv[0]);
}
pos.undo_move(RootMoves[0].pv[0]);
}
pos.this_thread()->wait_for_stop_or_ponderhit();
// Best move could be MOVE_NONE when searching on a stalemate position
pos.this_thread()->wait_for_stop_or_ponderhit();
// Best move could be MOVE_NONE when searching on a stalemate position
- cout << "bestmove " << move_to_uci(RootMoves[0].pv[0], Chess960)
- << " ponder " << move_to_uci(RootMoves[0].pv[1], Chess960) << endl;
+ sync_cout << "bestmove " << move_to_uci(RootMoves[0].pv[0], Chess960)
+ << " ponder " << move_to_uci(RootMoves[0].pv[1], Chess960) << sync_endl;
// Send full PV info to GUI if we are going to leave the loop or
// if we have a fail high/low and we are deep in the search.
if ((bestValue > alpha && bestValue < beta) || SearchTime.elapsed() > 2000)
// Send full PV info to GUI if we are going to leave the loop or
// if we have a fail high/low and we are deep in the search.
if ((bestValue > alpha && bestValue < beta) || SearchTime.elapsed() > 2000)
- cout << uci_pv(pos, depth, alpha, beta) << endl;
+ sync_cout << uci_pv(pos, depth, alpha, beta) << sync_endl;
// In case of failing high/low increase aspiration window and
// research, otherwise exit the fail high/low loop.
// In case of failing high/low increase aspiration window and
// research, otherwise exit the fail high/low loop.
{
Log log(Options["Search Log Filename"]);
log << pretty_pv(pos, depth, bestValue, SearchTime.elapsed(), &RootMoves[0].pv[0])
{
Log log(Options["Search Log Filename"]);
log << pretty_pv(pos, depth, bestValue, SearchTime.elapsed(), &RootMoves[0].pv[0])
}
// Filter out startup noise when monitoring best move stability
}
// Filter out startup noise when monitoring best move stability
Signals.firstRootMove = (moveCount == 1);
if (thisThread == Threads.main_thread() && SearchTime.elapsed() > 2000)
Signals.firstRootMove = (moveCount == 1);
if (thisThread == Threads.main_thread() && SearchTime.elapsed() > 2000)
- cout << "info depth " << depth / ONE_PLY
- << " currmove " << move_to_uci(move, Chess960)
- << " currmovenumber " << moveCount + PVIdx << endl;
+ sync_cout << "info depth " << depth / ONE_PLY
+ << " currmove " << move_to_uci(move, Chess960)
+ << " currmovenumber " << moveCount + PVIdx << sync_endl;
}
isPvMove = (PvNode && moveCount <= 1);
}
isPvMove = (PvNode && moveCount <= 1);
TT.clear();
else if (token == "isready")
TT.clear();
else if (token == "isready")
- cout << "readyok" << endl;
+ sync_cout << "readyok" << sync_endl;
else if (token == "position")
set_position(pos, is);
else if (token == "position")
set_position(pos, is);
pos.flip();
else if (token == "eval")
pos.flip();
else if (token == "eval")
- cout << Eval::trace(pos) << endl;
+ sync_cout << Eval::trace(pos) << sync_endl;
else if (token == "bench")
benchmark(pos, is);
else if (token == "key")
else if (token == "bench")
benchmark(pos, is);
else if (token == "key")
- cout << "key: " << hex << pos.key()
- << "\nmaterial key: " << pos.material_key()
- << "\npawn key: " << pos.pawn_key() << endl;
+ sync_cout << "key: " << hex << pos.key()
+ << "\nmaterial key: " << pos.material_key()
+ << "\npawn key: " << pos.pawn_key() << sync_endl;
- cout << "id name " << engine_info(true)
- << "\n" << Options
- << "\nuciok" << endl;
+ sync_cout << "id name " << engine_info(true)
+ << "\n" << Options
+ << "\nuciok" << sync_endl;
else if (token == "perft" && (is >> token)) // Read depth
{
else if (token == "perft" && (is >> token)) // Read depth
{
- cout << "Unknown command: " << cmd << endl;
+ sync_cout << "Unknown command: " << cmd << sync_endl;
if (!args.empty()) // Command line arguments have one-shot behaviour
{
if (!args.empty()) // Command line arguments have one-shot behaviour
{
if (Options.count(name))
Options[name] = value;
else
if (Options.count(name))
Options[name] = value;
else
- cout << "No such option: " << name << endl;
+ sync_cout << "No such option: " << name << sync_endl;