Muse Dash: Fix nondeterministic generation with include_songs (#6040)

The include_songs option is an OptionSet, whose value is a set, but was being iterated to produce self.included_songs. Sets are unordered and may have a different iteration order each time a python process is run. This meant that the order of the elements in self.included_songs could differ even when generating with a fixed seed.

This caused nondeterministic generation with the same seed because create_song_pool() deterministically randomly picks songs from self.included_songs, which could be in a different order each time, so different songs could be picked.
This commit is contained in:
Mysteryem
2026-03-29 22:12:25 +01:00
committed by GitHub
parent 5ca50cd8d3
commit 03c9d0717b

View File

@@ -124,7 +124,8 @@ class MuseDashWorld(World):
self.starting_songs = [s for s in start_items if s in song_items]
self.starting_songs = self.md_collection.filter_songs_to_dlc(self.starting_songs, dlc_songs)
self.included_songs = [s for s in include_songs if s in song_items and s not in self.starting_songs]
# Sort first for deterministic iteration order.
self.included_songs = [s for s in sorted(include_songs) if s in song_items and s not in self.starting_songs]
self.included_songs = self.md_collection.filter_songs_to_dlc(self.included_songs, dlc_songs)
# Making sure songs chosen for goal are allowed by DLC and remove the chosen from being added to the pool.