Skip to content
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

Plando: Prevent duplicate candidate locations #2286

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

Silvris
Copy link
Collaborator

@Silvris Silvris commented Oct 9, 2023

What is this fixing or adding?

https://discord.com/channels/731205301247803413/1161022518631608320/1161022518631608320
If a user specifies early_locations, non_early_locations, or manually puts the same location name multiple times in the locations field, plando can place items onto non-existent duplicate locations, leading to unfilled locations.

How was this tested?

Added the following plando to a default DS3 yaml, and generated alongside 2 LttP yamls.

  plando_items:
    - items:
        - Small Lothric Banner
        - Basin of Vows
      locations:
        - Mushroom
        - Mushroom
      from_pool: true
      world: true
      force: true

Checked that the issue was no longer present. It should be noted that in the case of specific duplication, it treats the length of the list as the number of unique locations.

If this makes graphical changes, please attach screenshots.

Copy link
Member

@black-sliver black-sliver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I still think we should rework how item plando is run under the hood when we have time since this had multiple issues now.

@@ -845,7 +845,7 @@ def failed(warning: str, force: typing.Union[bool, str]) -> None:
for target_player in worlds:
locations += non_early_locations[target_player]

block['locations'] = locations
block['locations'] = list(dict.fromkeys(locations))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this actually seems to be the fastest way to drop duplicates in vanilla python.

@black-sliver
Copy link
Member

Actually, I'm wondering if it's supposed to be more likely to hit a location if it's listed twice. Similar to weights.

@Berserker66
Copy link
Member

Actually, I'm wondering if it's supposed to be more likely to hit a location if it's listed twice. Similar to weights.

As the one who originally wrote plando before it was expanded on, I'm relatively sure I did not have that intention.

Copy link
Collaborator

@t3hf1gm3nt t3hf1gm3nt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested against the problem yamls/seed that was posted in the discord bug report, as well as a few more gens with different seeds. all genned successfully.

@ThePhar ThePhar added is: enhancement Issues requesting new features or pull requests implementing new features. affects: core Issues/PRs that touch core and may need additional validation. labels Oct 17, 2023
@black-sliver
Copy link
Member

Merging as-is. I was leaving this open for berserker to have the final looksies since this is valuable for rolling the async.

@black-sliver black-sliver merged commit 7c2cb34 into ArchipelagoMW:main Oct 21, 2023
12 checks passed
FlySniper pushed a commit to FlySniper/Archipelago that referenced this pull request Nov 14, 2023
Jouramie pushed a commit to Jouramie/Archipelago that referenced this pull request Feb 28, 2024
@Silvris Silvris deleted the plando_fix branch April 16, 2024 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants