Skip to content

Commit

Permalink
Fix compilation on MSVC.
Browse files Browse the repository at this point in the history
Various small fixes for compiling with MSVC2017.
  • Loading branch information
gcp committed Oct 25, 2017
1 parent 80c4517 commit 0d1791e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/UCTNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <functional>
#include <algorithm>
#include <random>
#include <numeric>
#include "FastState.h"
#include "UCTNode.h"
#include "UCTSearch.h"
Expand Down Expand Up @@ -186,7 +187,7 @@ void UCTNode::dirichlet_noise(float epsilon, float alpha) {

auto dirichlet_vector = std::vector<float>{};

std::gamma_distribution<> gamma(alpha, 1.0f);
std::gamma_distribution<float> gamma(alpha, 1.0f);
for (size_t i = 0; i < child_cnt; i++) {
dirichlet_vector.emplace_back(gamma(*Random::get_Rng()));
}
Expand Down Expand Up @@ -298,7 +299,7 @@ int UCTNode::get_visits() const {

float UCTNode::get_eval() const {
assert(!first_visit());
return m_blackevals / (double)get_visits();
return static_cast<float>(m_blackevals / (double)get_visits());
}

float UCTNode::get_eval(int tomove) const {
Expand Down
6 changes: 3 additions & 3 deletions src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <stdarg.h>
#include <thread>
#include <mutex>
#ifdef WIN32
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/select.h>
Expand Down Expand Up @@ -71,7 +71,7 @@ bool Utils::input_pending(void) {
}

if (dw) {
return input_causes_stop();
return true;
} else {
return false;
}
Expand All @@ -84,7 +84,7 @@ bool Utils::input_pending(void) {
if (dw <= 1) {
return false;
} else {
return input_causes_stop();
return true;
}
}
#endif
Expand Down

0 comments on commit 0d1791e

Please sign in to comment.