Question
Generate a combination of rooms and corridors in C programming Corridor symbol = # Specifications: Loop through the rooms array (n rooms), Use euclidean distance
Generate a combination of rooms and corridors in C programming
Corridor symbol = #
Specifications:
Loop through the rooms array (n rooms),
Use euclidean distance from middle of room to middle of destination room.
Carve path towards the destination. (Loop towards destination, if rock => #)
The dungeon should be fully connected, meaning that from any position on the floor, your adventurer should be able to walk to any other position on the floor without passing through rock. Corridors should not extend into rooms, e.g., no hashes should be rendered inside rooms.
and add a little randomness in the direction
Below is how the out put will look:
# = corridors
. = rooms
> upstairs
white space = rocks
###.... #### ## # ### # ### # ## | # # # # #.....>.. ##, ## # ## ######## #######, # #.. #### ## ## ###># ## ######## ## # ### ### #### <.. .>.. ##, ## # ## ######## #######, # #.. #### ## ## ###># ## ######## ## # ### ### #### <.. .>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started