Roguelike: Synthesis
Combine all four map generation algorithms behind a strategy enum — switch generators and regenerate maps with new seeds at the press of a key.
No login required.
Algorithm Switcher
Combine all four generators behind a single enum and add keyboard-driven regeneration. Switch algorithms with arrow keys and generate new maps with spacebar.
The Strategy pattern lets you swap algorithms at runtime -- a fundamental design pattern used everywhere from game AI to rendering backends.
Loading game...
Click the game window to interact with it
What You'll Build
You will combine all four map generation algorithms behind a single enum-based strategy selector. A match statement routes to the correct generator, and pressing a key regenerates the map with a new random seed. This part is about architecture — how to organize multiple algorithms behind a clean interface so they are interchangeable at runtime.
Learning Goals
- ✓Enum definition for generator strategy selection
- ✓Match statements for routing to different algorithms
- ✓Seed regeneration with a keypress callback
- ✓Shared interface pattern: all generators write to the same grid format
GDScript Concepts in This Part
Tips
- ✨Define a clear generate(grid, rng) interface that all four algorithms follow — this makes swapping strategies a one-line change.
- ✨Print the current seed and algorithm name to the console for easy debugging and reproducibility.