-
Notifications
You must be signed in to change notification settings - Fork 188
chaining: Re-generate actions when branching #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll test it out now.
textworld/generator/chaining.py
Outdated
@@ -406,6 +422,9 @@ def apply(self, node: _Node, action: Action) -> Optional[State]: | |||
new_state.apply(action) | |||
|
|||
# Some debug checks | |||
# XXX | |||
if not self.check_state(new_state): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I agree with moving this after the apply
and we can remove the check_state
at line 419 I think. I had to do it in #36 since now some (expanded) rules might generate invalid state (e.g. in(box, box'), we are not allowing nested boxes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tavianator forget what I said about removing the first check_state
(line 419). Removing it would cause duplicate in the chains we generate. Let's just remove the assert then.
textworld/generator/chaining.py
Outdated
backtracks = node.backtracks[:i] | ||
parent = node.dep_parent | ||
parents = [] | ||
while parent.action: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be while parent and parent.action
This improves the quality of quests that include navigation actions, by re-generating actions after the player has moved into a new room, for example.
587414f
to
dd90df1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new code generates better quests. +1
This improves the quality of quests that include navigation actions, by
re-generating actions after the player has moved into a new room, for
example.