Click here to Skip to main content
15,392,679 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm working on an assignment, but I was stuck from the very beginning. In the assignment, I am asked to create a random maze. It will then be a playable game by combining the arrow keys. the user will play in a maze of any size he wants with inputs between 10 and 100. According to my research, I came across complex algorithms (dfs etc). Can you tell me where I should start? I cannot give the code samples as I cannot go further. I would be glad if you could help!

What I have tried:

unfortunately nothing. or rather I could not try
Posted
Updated 21-May-21 13:55pm

I used some code from : GitHub - drasis/cpp_maze_generation: generating mazes in different shapes[^] to make mine. Sorry, I can't show you a shot right now.

I found a link there to a great reference page on mazes : Think Labyrinth: Maze Algorithms[^]

Between those two pages you should be able to get going.

ETA: here's a shot from my maze program. It's a 3D display written with OpenGL that can be pan, zoomed, and rotated. GLmaze screen shot[^]. The green dot on the left was the start and the red one on the right is the end. Sorry, I'm not going to share the code. :)

I found the key to be in the data organization. You have to figure out how to store the data received from the maze generator in a way that can be used to display the shape and also be used to determine a path through it.
   
v2
Comments
Patrice T 21-May-21 19:27pm
   
+5
Rick York 21-May-21 20:09pm
   
thank you, sir.
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
   
For some Idea about programming a 2D Maze look at this:

Maze generation algorithm - Wikipedia[^]

Programming Mazes - YouTube[^]
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900