Skip to content

Commit

Permalink
Address warnings and syntax mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGisi committed Jul 30, 2024
1 parent bb6fd89 commit fab7bc2
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ _deps
.idea/*
cmake-build-debug/*
cmake-build-release/*

build-dir/
build/
dist/

test/config.sh
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ else()
endif()

target_include_directories(prometheus PUBLIC)

find_package(Threads REQUIRED)
target_link_libraries(prometheus PRIVATE Threads::Threads)

8 changes: 4 additions & 4 deletions src/hashing/pvtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ PVTable& PVTable::operator=(const PVTable &rhs) {
*/
void PVTable::store(const PosKey& key, PVEntry value) {
uint64_t idx = hash(key);
assert(idx >= 0 && idx <= entries-1);
assert(idx <= entries-1);
assert(value.full == true);
assert(value.move.move.move != 0);
assert(value.move.move.to_int() != 0);

bool do_store = false;
if (table[idx].full) {
Expand All @@ -89,7 +89,7 @@ void PVTable::store(const PosKey& key, PVEntry value) {
*/
std::optional<PVTable::PVEntry> PVTable::probe(const PosKey &key) {
uint64_t idx = hash(key);
assert(idx >= 0 && idx <= entries-1);
assert(idx <= entries-1);

if (table[idx].full && table[idx].posKey == key)
return table[idx];
Expand All @@ -113,7 +113,7 @@ std::optional<SearchMove> PVTable::probe_move(const PosKey& key, int alpha, int
int score;
uint64_t idx = hash(key);

assert(idx >= 0 && idx <= entries-1);
assert(idx <= entries-1);
assert(depth >= 1 && depth <= MAX_DEPTH);
assert(alpha < beta);
assert(alpha >= -INFINITE && alpha <= INFINITE);
Expand Down
2 changes: 1 addition & 1 deletion src/io/uci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +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:%llu stop:%llu depth:%d timeset:%d",
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 << std::endl;

Expand Down
8 changes: 8 additions & 0 deletions src/move/move.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class Move {
Move& operator=(const Move& rhs);
bool operator==(const Move& rhs) const;

[[nodiscard]] inline bool is_no_move() const {
return move == 0;
}

[[nodiscard]] inline int from() const {
return move & 0x7F;
}
Expand Down Expand Up @@ -65,6 +69,10 @@ class Move {
return move & 0x7C000;
}

[[nodiscard]] int to_int() const {
return move;
}

[[nodiscard]] std::string to_str() const;
static Move from_str(const std::string & move_str, Board & board);

Expand Down
2 changes: 1 addition & 1 deletion src/search/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ inline void search(Board& board, SearchInfo& info) {
if(info.stopped)
break;

printf("info score cp %d depth %d nodes %llu time %llu ",
printf("info score cp %d depth %d nodes %lu time %lu ",
best_score, current_depth, info.nodes, get_time()-info.start_time);
printf("pv");
for(pv_num = 0; pv_num < pv_moves; pv_num++) {
Expand Down

0 comments on commit fab7bc2

Please sign in to comment.