Question: Write a C program that generates a maze using this algorithm and prints it out. Make the maze 25 by 25 cells. Start in coordinate

Write a C program that generates a maze using this algorithm and prints it out. Make the maze 25 by 25 cells. Start in coordinate 1,1. The maze should be a little different each time you run it. No need to assign an exit.

digTunnel(maze, x, y) Generate random array of 4 numbers representing up,down,left,right Loop through each one of the directions For the current direction, check if moving two cells in that direction results in being out of the maze or on the border, or if it's a blank. If so, do nothing. Otherwise, it has to be a wall. Tunnel by making two blanks in the direction. Recursively call digTunnel with the new coordinates (x+-2 or y+-2). 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!