Exercises
To help you test your knowledge of this chapter's content, here are a few exercises that you should work on. They are not imperative to the rest of the book, but working on them will help you assess your strengths and weaknesses in the material covered:
There are many different algorithms available that could be used to generate mazes, such as the randomized Prim's algorithm and Kruskal's algorithm. Choose one of these algorithms and have a go at replacing the recursive backtracking implementation with your own implementation.
We worked with quite a small level size. Try increasing it and varying the characteristics of the levels that are generated. Increase the number of rooms, their size, and so on.
You may have noticed that our torches are missing! Since we no longer load the level from a level file, we need to add them ourselves. Torches should be placed on tiles of the
TILE::WALL_TOP
type. Have a go at creating this function yourself. If you get stuck, you can always look at...