Io rework #15

Merged
rektdie merged 7 commits from IO_rework into legalMovegen 2025-03-12 19:42:20 +01:00
5 changed files with 26 additions and 26 deletions
Showing only changes of commit 7fb413fb01 - Show all commits

No files matched your search

+5 -5
View File
@@ -3,7 +3,7 @@
void Bitboard::PrintBoard() const { void Bitboard::PrintBoard() const {
for (int rank = 7; rank >= 0; rank--) { for (int rank = 7; rank >= 0; rank--) {
std::cout << "+---+---+---+---+---+---+---+---+\n"; std::cout << "+---+---+---+---+---+---+---+---+" << std::endl;
std::cout << "| "; std::cout << "| ";
for (int file = 0; file < 8; file++) { for (int file = 0; file < 8; file++) {
@@ -15,12 +15,12 @@ void Bitboard::PrintBoard() const {
std::cout << ". | "; std::cout << ". | ";
} }
} }
std::cout << ' ' << rank + 1 << '\n'; std::cout << ' ' << rank + 1 << std::endl;
} }
std::cout << "+---+---+---+---+---+---+---+---+\n"; std::cout << "+---+---+---+---+---+---+---+---+" << std::endl;
std::cout << " a b c d e f g h\n\n"; std::cout << " a b c d e f g h" << std::endl << std::endl;
std::cout << " Board: 0x" << std::hex << m_board << '\n'; std::cout << " Board: 0x" << std::hex << m_board << std::endl;
} }
bool Bitboard::IsSet(int square) const { bool Bitboard::IsSet(int square) const {
+10 -10
View File
@@ -76,7 +76,7 @@ void Board::PrintBoard() {
for (int rank = 7; rank >= 0; rank--) { for (int rank = 7; rank >= 0; rank--) {
std::cout << "+---+---+---+---+---+---+---+---+\n"; std::cout << "+---+---+---+---+---+---+---+---+" << std::endl;
std::cout << "| "; std::cout << "| ";
for (int file = 0; file < 8; file++) { for (int file = 0; file < 8; file++) {
@@ -97,21 +97,21 @@ void Board::PrintBoard() {
std::cout << " | "; std::cout << " | ";
} }
} }
std::cout << ' ' << rank + 1 << '\n'; std::cout << ' ' << rank + 1 << std::endl;
} }
std::cout << "+---+---+---+---+---+---+---+---+\n"; std::cout << "+---+---+---+---+---+---+---+---+" << std::endl;
std::cout << " a b c d e f g h\n\n"; std::cout << " a b c d e f g h" << std::endl << std::endl;
std::cout << " Side to move: "; std::cout << " Side to move: ";
if (!sideToMove) { if (!sideToMove) {
std::cout << "White\n"; std::cout << "White" << std::endl;
} else { } else {
std::cout << "Black\n"; std::cout << "Black" << std::endl;
} }
if (enPassantTarget != noEPTarget) { if (enPassantTarget != noEPTarget) {
std::cout << " En Passant square: " << squareCoords[enPassantTarget] << '\n'; std::cout << " En Passant square: " << squareCoords[enPassantTarget] << std::endl;
} else { } else {
std::cout << " En Passant square: None" << '\n'; std::cout << " En Passant square: None" << std::endl;
} }
std::cout << " Castling rights: "; std::cout << " Castling rights: ";
@@ -119,9 +119,9 @@ void Board::PrintBoard() {
if (castlingRights & whiteQueenRight) std::cout << "Q"; else std::cout << "-"; if (castlingRights & whiteQueenRight) std::cout << "Q"; else std::cout << "-";
if (castlingRights & blackKingRight) std::cout << "k"; else std::cout << "-"; if (castlingRights & blackKingRight) std::cout << "k"; else std::cout << "-";
if (castlingRights & blackQueenRight) std::cout << "q"; else std::cout << "-"; if (castlingRights & blackQueenRight) std::cout << "q"; else std::cout << "-";
std::cout << "\n\n"; std::cout << std::endl << std::endl;
std::cout << " Hashkey: " << std::hex << hashKey << '\n'; std::cout << " Hashkey: 0x" << std::hex << hashKey << std::dec << std::endl;
} }
void Board::AddMove(Move move) { void Board::AddMove(Move move) {
+4 -4
View File
@@ -32,11 +32,11 @@ void Perft(Board &board, int depth) {
totalNodes += nodeCount; totalNodes += nodeCount;
board.moveList[i].PrintMove(); board.moveList[i].PrintMove();
std::cout << ": " << nodeCount << '\n'; std::cout << ": " << nodeCount << std::endl;
} }
std::cout << "\nDepth: " << depth << '\n'; std::cout << std::endl << "Depth: " << depth << std::endl;
std::cout << "Total nodes: " << totalNodes << '\n'; std::cout << "Total nodes: " << totalNodes << std::endl;
std::cout << "Time took: " << sw.GetElapsedSec() << "s ("; std::cout << "Time took: " << sw.GetElapsedSec() << "s (";
std::cout << int(totalNodes / sw.GetElapsedSec()) << " nodes/sec)\n"; std::cout << int(totalNodes / sw.GetElapsedSec()) << " nodes/sec)" << std::endl;
} }
+1 -1
View File
@@ -314,7 +314,7 @@ void SearchPosition(Board &board, SearchParams params) {
std::cout << "bestmove "; std::cout << "bestmove ";
results.bestMove.PrintMove(); results.bestMove.PrintMove();
std::cout << '\n'; std::cout << std::endl;
} }
void StopSearch() { void StopSearch() {
+6 -6
View File
@@ -170,11 +170,11 @@ static void SetOption(std::string &command) {
} }
static void PrintEngineInfo() { static void PrintEngineInfo() {
std::cout << "id name Eleanor\n"; std::cout << "id name Eleanor" << std::endl;
std::cout << "id author rektdie\n"; std::cout << "id author rektdie" << std::endl;
std::cout << "option name Hash type spin default 5 min 1 max 64\n"; std::cout << "option name Hash type spin default 5 min 1 max 64" << std::endl;
std::cout << "option name Threads type spin default 1 min 1 max 1\n"; std::cout << "option name Threads type spin default 1 min 1 max 1" << std::endl;
std::cout << "uciok\n"; std::cout << "uciok" << std::endl;
} }
void UCILoop(Board &board) { void UCILoop(Board &board) {
@@ -200,7 +200,7 @@ void UCILoop(Board &board) {
// parse UCI "isready" command // parse UCI "isready" command
if (input.find("isready") != std::string::npos) { if (input.find("isready") != std::string::npos) {
std::cout << "readyok\n"; std::cout << "readyok" << std::endl;
continue; continue;
} }