GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — cppchess_engine/tb.cpp at HandcraftedEngine · winapiadmin/cppchess_engine Expand file tree/ Copy pathtb.cppMore file actions 59 lines (47 loc) · 1.52 KB / Copy pathtb.cppFile metadata and controls59 lines (47 loc) · 1.52 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 #include "tb.h" #include <exception> #include <iostream> #include <tbprobe.h> #include <unordered_set> namespace engine::tb { tbprobe::syzygy::Tablebase tablebase; namespace { std::size_t unique_table_count(const std::unordered_map<std::string, tbprobe::syzygy::Table *> &tables) { std::unordered_set<const tbprobe::syzygy::Table *> uniqueTables; for (const auto &[_, table] : tables) if (table != nullptr) uniqueTables.insert(table); return uniqueTables.size(); } } // namespace void init(const std::string &path) { tablebase.close(); if (path.empty()) { std::cout << "info string Found 0 WDL and 0 DTZ tablebase files\n"; return; } try { tbprobe::syzygy::initialize(); tablebase.add_directory(path, true, true); std::cout << "info string Found " << wdl_count() << " WDL and " << dtz_count() << " DTZ tablebase files\n"; } catch (const std::exception &e) { std::cout << "info string Syzygy init failed: " << e.what() << '\n'; } } std::size_t wdl_count() { return unique_table_count(tablebase.wdl); } std::size_t dtz_count() { return unique_table_count(tablebase.dtz); } int probe_wdl(chess::Position &board) { try { return *tablebase.get_wdl(board, TB_ERROR); } catch (const std::exception &) { return TB_ERROR; } } int probe_dtz(chess::Position &board) { try { return *tablebase.get_dtz(board, TB_ERROR); } catch (const std::exception &) { return TB_ERROR; } } } // namespace engine::tb |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |