-
Notifications
You must be signed in to change notification settings - Fork 836
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
GER: Only consider usable exits when calculating dead-ends #4701
base: main
Are you sure you want to change the base?
Conversation
Would like to have a test added for this since we have an easy to represent test case (namely, the one diagrammed here) and entrance classification is not dependent on any random processes. |
Seems easy enough. That last commit was just to fix the broken tests that were using EntranceLookup directly, but I can definitely add a new unit test as well. |
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.
Change and test looks good.
for dead_end in dead_end_region.entrances: | ||
if dead_end.name == "region20_top": | ||
break | ||
# there should be only this one dead-end |
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.
It wasn't immediately clear to me why this should be the case (because this region has only a top and right exit and the right has been pulled out of the set) so perhaps additional exposition may be in order
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.
Discussed in the thread, looks reasonable to me, code review came up fine.
based on review feedback
What is this fixing or adding?
Previously, when making a call to
randomize_entrances
and passing a specific list of entrances and exits to actually randomize, it would consider all possible exits from a region when determining whether or not an entrance should be considered a dead-end.However, that meant it would consider exits it had not been told to shuffle, which resulted in these entrances getting placed early and causing the algorithm to fail. This change now correctly ignores exits it is not going to shuffle, and as such, correctly determines that entrances that only connect to exits that won't be shuffled should actually be considered dead-ends.
How was this tested?
Tested with my in-progress GER implementation for my Crystalis .apworld, which contains the following example:

(Visualized using the improvements in #4685.)
In this example, my first call to GER shuffles the red entrances leading into and out of Windmill Exterior, but not the black entrances. This region therefore should be considered a dead-end, which I confirmed with a breakpoint in
_can_expand_graph
.