aboutsummaryrefslogtreecommitdiff
path: root/src/uci.cpp
diff options
context:
space:
mode:
authorAdam <adammegarules1@gmail.com>2026-07-29 08:49:58 +0200
committerAdam <adammegarules1@gmail.com>2026-07-29 08:49:58 +0200
commit815abe7aabf47814dc391d19dedd6e9b23f100a1 (patch)
treed7a957fef8a6ea5c00bd84bf1b8046004421785c /src/uci.cpp
parentccb929172587fbfb8fb000d7992bdbbdac6f53ae (diff)
adding transpositions
Diffstat (limited to 'src/uci.cpp')
-rw-r--r--src/uci.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/uci.cpp b/src/uci.cpp
index 4e32d6f..b4e384a 100644
--- a/src/uci.cpp
+++ b/src/uci.cpp
@@ -15,6 +15,7 @@
#include <chrono>
#include <fstream>
#include <iomanip>
+#include <unordered_map>
std::ofstream uciLog("uci_log.txt", std::ios::app);
@@ -44,7 +45,8 @@ Move UciToMove(string uci) {
return {from, to};
}
-static Game initBoard(string startingFEN) {
+Game initBoard(string startingFEN,
+ std::unordered_map<uint64_t, float> *transPositions) {
Game b{};
b.enPassant = IndexToPosition(0); // default value
b.canEnpassant = false;
@@ -53,7 +55,7 @@ static Game initBoard(string startingFEN) {
b.castle = "";
b.halfMoveClock = 0;
b.MoveClock = 0;
- setBoardFen(startingFEN, &b);
+ b.Transpositions = transPositions;
Piece EmptyPiece = {
false,
@@ -64,11 +66,15 @@ static Game initBoard(string startingFEN) {
b.pieces[i] = EmptyPiece;
};
+ setBoardFen(startingFEN, &b);
+
return b;
};
void Uci() {
+ unordered_map<uint64_t, float> transpositions = {};
Game game =
- initBoard("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
+ initBoard("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
+ &transpositions);
string line;
@@ -85,7 +91,8 @@ void Uci() {
cout.flush();
} else if (cmd == "ucinewgame") {
game =
- initBoard("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
+ initBoard("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
+ &transpositions);
} else if (cmd == "isready") {
cout << "readyok\n";
cout.flush();
@@ -126,7 +133,8 @@ void Uci() {
if (token == "startpos") {
game = initBoard(
- "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
+ "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
+ &transpositions);
} else if (token == "fen") {
string fen;
string part;
@@ -139,7 +147,7 @@ void Uci() {
fen += part;
}
- game = initBoard(fen);
+ game = initBoard(fen, &transpositions);
}
// check for moves