Skip to content

Commit

Permalink
Remove printf
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGisi committed Jul 30, 2024
1 parent fab7bc2 commit 4b797d3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/board/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,20 +526,20 @@ void Board::print_squares_attacked(int att_side) const {
int file = 0;
int sq = 0;

printf("\n\nSquares attacked by:%c\n", sideChar[att_side]);
std::cout << "Squares attacked by " << sideChar[att_side] << std::endl;
for(rank = RANK_8; rank >= RANK_1; --rank) {
for(file = FILE_A; file <= FILE_H; ++file) {
sq = FR2SQ(file,rank);
if(sq_attacked(sq, att_side)) {
printf("X");
std::cout << 'X';
} else {
printf("-");
std::cout << '-';
}

}
printf("\n");
std::cout << std::endl;
}
printf("\n\n");
std::cout << std::endl << std::endl;
}

std::string Board::sq_to_str(const int sq) {
Expand Down
3 changes: 1 addition & 2 deletions src/io/uci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ void uci_parse_go(Board &board, std::istringstream is, SearchInfo &info) {

info.depth = (depth == -1) ? MAX_DEPTH : depth;

printf("info string time:%d start:%lu stop:%lu depth:%d timeset:%d",
time,info.start_time,info.stop_time,info.depth,info.time_set);
std::cout << "info string time:" << time << " start:" << info.start_time << " stop:" << info.stop_time << " depth:" << info.depth << " timeset:" << info.time_set;
std::cout << std::endl;

std::thread (search, std::ref(board), std::ref(info)).detach();
Expand Down
4 changes: 2 additions & 2 deletions src/move/move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Move::Move() {
move = 0;
}

Move::Move(uint32_t m) {
Move::Move(int m) {
move = m;
}

Move::Move(int from, int to, int cap, int pro, int f1) {
move = static_cast<uint32_t>(from | (to << 7) | (cap << 14) | (pro << 20 | f1));
move = from | (to << 7) | (cap << 14) | (pro << 20 | f1);
}

Move Move::from_str(const std::string &move_str, Board &board) {
Expand Down
2 changes: 1 addition & 1 deletion src/move/move.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Board;
class Move {
public:
Move();
explicit Move(uint32_t m);
explicit Move(int m);
Move(int from, int to, int cap, int pro, int f1);

Move(const Move& rhs);
Expand Down
6 changes: 2 additions & 4 deletions src/search/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,9 @@ inline void search(Board& board, SearchInfo& info) {
if(info.stopped)
break;

printf("info score cp %d depth %d nodes %lu time %lu ",
best_score, current_depth, info.nodes, get_time()-info.start_time);
printf("pv");
std::cout << "info score cp " << best_score << " depth " << current_depth << " nodes " << info.nodes << " time " << get_time()-info.start_time << " pv ";
for(pv_num = 0; pv_num < pv_moves; pv_num++) {
printf(" %s", board.pvArray[pv_num].to_str().c_str());
std::cout << " " << board.pvArray[pv_num].to_str();
}
std::cout << std::endl;

Expand Down

0 comments on commit 4b797d3

Please sign in to comment.