Skip to content

Commit

Permalink
Fix bug in DF
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuandong Tian committed Oct 7, 2017
1 parent 2bc9c41 commit a2afcfb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions elf/replay_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@ class ReplayLoaderT {
using RBuffer = SharedReplayBuffer<K, Record>;
using GenFunc = typename RBuffer::GenFunc;

private:
// Shared buffer for OfflineLoader.
static std::unique_ptr<RBuffer> _rbuffer;

RIterator _it;

public:
static void Init(GenFunc func) {
_rbuffer.reset(new RBuffer(func));
}

void Init() { reload(); }

const RIterator &curr() const { return _it; }

void Next() {
Expand All @@ -36,6 +31,11 @@ class ReplayLoaderT {
}

private:
// Shared buffer for OfflineLoader.
static std::unique_ptr<RBuffer> _rbuffer;

RIterator _it;

void reload() {
while (true) {
K k = get_key();
Expand Down
3 changes: 2 additions & 1 deletion go/offpolicy_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ string OfflineLoader::_path;

OfflineLoader::OfflineLoader(const GameOptions &options, int seed)
: _options(options), _game_loaded(0), _rng(seed) {
ReplayLoader::Init();
}

void OfflineLoader::InitSharedBuffer(const std::string &list_filename) {
Expand Down Expand Up @@ -98,7 +99,7 @@ std::string OfflineLoader::get_key() {
}

bool OfflineLoader::need_reload(const Sgf::iterator &it) const {
return (it.done() || it.StepLeft() < _options.num_future_actions
return (it.done() || it.StepLeft() < _options.num_future_actions
|| (_options.move_cutoff >= 0 && it.GetCurrIdx() >= _options.move_cutoff));
}

Expand Down

0 comments on commit a2afcfb

Please sign in to comment.