Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (adrimit):

how can i write a program in C to generate a maze given by a file? this maze will be defined by a square matrix of hexadecimal nibbles...

OpenStudy (caominhim):

you'll want to use a minimum spanning tree, kruskal's algorithm for example

OpenStudy (adrimit):

maybe a better way to ask the question is "how can I write the file that describes a specific maze?"

OpenStudy (caominhim):

so you're asking what the input syntax should be for the maze file? or how to interpret the syntax you've already been given?

OpenStudy (adrimit):

First the syntax, then an algorithm to interpret the file to build the maze. For example, I can represent the directions in which the user can leave each cell by a four bit statement; where each bit represents a direction and if a bit is on then the user can leave in that direction (i.e. up =1000 or 8, right =0100 or 4, left =0010 or 2, down =0001 or 1, up & right =1100 or C, etc). so the following matrix 1 5 2 C B 1 4 E A represents ________ | | __| |__ | | |_______|

OpenStudy (caominhim):

okay so you already have a maze generated, you're asking how to print it out visually? you could use pictures, you could make it lines like you did above, or do you have something else in mind? or have you already figured it out?

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!