Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Fixes from review and tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmatters committed May 9, 2022
1 parent 422b044 commit 570080e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nle/dataset/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def create(filename=DB):
c.execute(
"""CREATE TABLE meta
(
time REAL,
ctime REAL,
mtime REAL
)"""
)
Expand Down
11 changes: 9 additions & 2 deletions nle/dataset/populate_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ def altorg_filename_to_timestamp(filename):
ts = filename.split("/")[-1][:-11]
try:
ts = datetime.datetime.fromisoformat(ts)
except AttributeError:
# Python 3.6 doesnt have fromisoformat
this_date, this_time = ts.split(".")
this_date = [int(x) for x in this_date.split("-")]
this_time = [int(x) for x in this_time.split(":")]
this_datetime = this_date + this_time
ts = datetime.datetime(*this_datetime)
except ValueError:
logging.info("Skipping: '%s'" % filename)
return -1
Expand Down Expand Up @@ -112,9 +119,9 @@ def add_altorg_directory(path, name, filename=db.DB):
└── blacklist.txt
Note that unlike `nle` ttyrecs, altorg episodes may be split into parts.
We use a simple algorith based on the file creation times and xlogfile times
We use a simple algorithm based on the file creation times and xlogfile times
for the start and end of games to try to assign ttyrecs to games, knowing
a player can only ever be playing on game on altorg at a time.
a player can only ever be playing on game one altorg at a time.
This algorithm should be deterministic and always return the same dataset
from an empty database, regardless of environment.
Expand Down
2 changes: 1 addition & 1 deletion third_party/converter/converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Conversion *conversion_create(size_t rows, size_t cols, size_t term_rows,
size_t term_cols, int is_v2);
void conversion_set_buffers(Conversion *c, unsigned char *chars, size_t chars_size,
signed char *colors, size_t colors_size,
int16_t *curcurs, size_t curcurs_size,
int16_t *cursors, size_t cursors_size,
int64_t *timestamps, size_t timestamps_size,
unsigned char *inputs, size_t inputs_size);
int conversion_load_ttyrec(Conversion *c, FILE *f);
Expand Down

0 comments on commit 570080e

Please sign in to comment.