Skip to content

Commit

Permalink
Fix CMake build problems from recent additions to evaluate_bots.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 377245992
Change-Id: I98c0b6571409e4b6056850c21ec0a098185b8027
  • Loading branch information
lanctot authored and open_spiel@google.com committed Jun 3, 2021
1 parent 1651b55 commit 526271f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions open_spiel/algorithms/evaluate_bots.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
#include "open_spiel/algorithms/evaluate_bots.h"

#include <limits>
#include <random>
#include <vector>

#include "open_spiel/abseil-cpp/absl/time/time.h"
#include "open_spiel/abseil-cpp/absl/random/distributions.h"
#include "open_spiel/spiel.h"
#include "open_spiel/spiel_bots.h"

Expand Down Expand Up @@ -70,8 +73,9 @@ std::vector<double> EvaluateBots(const Game& game,

std::vector<double> EvaluateBots(const Game& game,
const std::vector<Bot*>& bots) {
absl::BitGen gen;
const int seed = absl::Uniform<int>(gen, std::numeric_limits<int>::min(),
absl::Duration time_gap = absl::Now() - absl::UnixEpoch();
std::mt19937 rng(absl::ToInt64Nanoseconds(time_gap));
const int seed = absl::Uniform<int>(rng, std::numeric_limits<int>::min(),
std::numeric_limits<int>::max());
return EvaluateBots(game, bots, seed);
}
Expand Down
6 changes: 5 additions & 1 deletion open_spiel/julia/wrapper/spieljl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,11 @@ JLCXX_MODULE define_julia_module(jlcxx::Module& mod) {
.constructor<const open_spiel::Game&,
const std::unordered_map<std::string, int>&, int>();

mod.method("evaluate_bots", &open_spiel::EvaluateBots);
mod.method("evaluate_bots", [](open_spiel::State* state,
const std::vector<open_spiel::Bot*>& bots,
int seed) {
return open_spiel::EvaluateBots(state, bots, seed);
});
mod.method("exploitability", [](const open_spiel::Game& game,
const open_spiel::Policy& policy) {
return open_spiel::algorithms::Exploitability(game, policy);
Expand Down

0 comments on commit 526271f

Please sign in to comment.