Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 140ff36

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 8a2c336 according to the output from Autopep8. Details: None
1 parent 2bb1c25 commit 140ff36

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎Dynamic Music Generator/dynamic_music_generator.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,30 +171,35 @@
171171
}
172172

173173
# Simulated in-game events
174+
175+
174176
def simulate_game_events():
175177
while True:
176178
yield random.choice(list(event_music_mapping.keys()))
177179

178180
# Main loop
181+
182+
179183
def main():
180184
events = simulate_game_events()
181-
185+
182186
for event in events:
183187
# Handle the in-game event and update the music
184188
if event in event_music_mapping:
185189
event_music = event_music_mapping[event]
186190
new_element = random.choice(event_music)
187191
else:
188192
new_element = random.choice(music_elements)
189-
193+
190194
if new_element != current_element:
191195
current_element.stop()
192196
current_element = pygame.mixer.Sound(new_element)
193197
current_element.play()
194-
198+
195199
# Simulated delay between events
196200
time.sleep(random.uniform(5, 15))
197201

202+
198203
if __name__ == "__main__":
199204
try:
200205
main()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /