Closed MarcCote closed 5 years ago
Hmm. I think we should (also?) fix this in the logic layer. Actually what's wrong with having a different ordering for the child types?
Same seed will generate different games on different machines.
@tavianator I agree we should fix it in the logic but I needed a quick fix. Also, I wasn't entirely sure if simply sorting the children would be enough or would the order in which we read the logic files might affect other parts of GameLogic!
As an example, let say we want to sample an object which has some attributes.
HOLDER_TYPES = list(itertools.chain(*M.kb.logic.types.multi_descendants(HOLDER_TYPES)))
type = rng.choice(HOLDER_TYPES)
OBJECTS_TYPES = list(M.kb.logic.types.get("o").subtypes)
type = rng.choice(OBJECTS_TYPES)
I made https://github.com/microsoft/TextWorld/pull/177 with an alternative fix, let me know if that works
Closed in favor of #177
A sneaky bug was happening when generating games on different machines.
Indirectly, the ordering of the dictionary
Type.children
was depending on the ordering of the*.twl
files as returned by the OS (viaglob.glob
). As a result, the order of the child types was machine-dependent (see https://github.com/microsoft/TextWorld/blob/master/textworld/logic/__init__.py#L263)