mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 16:47:37 +00:00
Fix base_dir not being applied to singular filenames.
This commit is contained in:
+29
-11
@@ -157,6 +157,32 @@ namespace Learner
|
|||||||
using Loss = Detail::Loss<false>;
|
using Loss = Detail::Loss<false>;
|
||||||
using AtomicLoss = Detail::Loss<true>;
|
using AtomicLoss = Detail::Loss<true>;
|
||||||
|
|
||||||
|
static void append_files_from_dir(
|
||||||
|
std::vector<std::string>& filenames,
|
||||||
|
const std::string& base_dir,
|
||||||
|
const std::string& target_dir)
|
||||||
|
{
|
||||||
|
string kif_base_dir = Path::combine(base_dir, target_dir);
|
||||||
|
|
||||||
|
namespace sys = std::filesystem;
|
||||||
|
sys::path p(kif_base_dir); // Origin of enumeration
|
||||||
|
std::for_each(sys::directory_iterator(p), sys::directory_iterator(),
|
||||||
|
[&](const sys::path& path) {
|
||||||
|
if (sys::is_regular_file(path))
|
||||||
|
filenames.push_back(Path::combine(target_dir, path.filename().generic_string()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rebase_files(
|
||||||
|
std::vector<std::string>& filenames,
|
||||||
|
const std::string& base_dir)
|
||||||
|
{
|
||||||
|
for (auto& file : filenames)
|
||||||
|
{
|
||||||
|
file = Path::combine(base_dir, file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// A function that converts the evaluation value to the winning rate [0,1]
|
// A function that converts the evaluation value to the winning rate [0,1]
|
||||||
double winning_percentage(double value)
|
double winning_percentage(double value)
|
||||||
{
|
{
|
||||||
@@ -1359,18 +1385,10 @@ namespace Learner
|
|||||||
|
|
||||||
LearnerThink learn_think(thread_num, seed);
|
LearnerThink learn_think(thread_num, seed);
|
||||||
|
|
||||||
// Display learning game file
|
rebase_files(filenames, base_dir);
|
||||||
if (target_dir != "")
|
if (!target_dir.empty())
|
||||||
{
|
{
|
||||||
string kif_base_dir = Path::combine(base_dir, target_dir);
|
append_files_from_dir(filenames, base_dir, target_dir);
|
||||||
|
|
||||||
namespace sys = std::filesystem;
|
|
||||||
sys::path p(kif_base_dir); // Origin of enumeration
|
|
||||||
std::for_each(sys::directory_iterator(p), sys::directory_iterator(),
|
|
||||||
[&](const sys::path& path) {
|
|
||||||
if (sys::is_regular_file(path))
|
|
||||||
filenames.push_back(Path::combine(target_dir, path.filename().generic_string()));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << "learn from ";
|
cout << "learn from ";
|
||||||
|
|||||||
Reference in New Issue
Block a user