# C# : Maze Program



## Kreij (Dec 4, 2009)

Okay kids, I thought it would be fun to write a program to generate random mazes. 

I usually go through the code and explain things, but this time I am just going to drop off the source code and let you have fun with it. If you have any questions post them here and I will be happy to explain whatever you want.

Feel free to expand upon it and post your changes and results !!!

It's a Visual Studio project written in C#.


----------



## Kreij (Dec 4, 2009)

So ... no one have a comments on my little project?
Did anyone compile it and try it?


----------



## Solaris17 (Dec 4, 2009)

main rig is down  no sweet apps on my laptop.


----------



## Kreij (Dec 4, 2009)

Solaris17 said:


> main rig is down  no sweet apps on my laptop.



Okay, Sol. I'll forgive you ... this time.


----------



## unibrow1990 (Dec 5, 2009)

I compiled it and tried it out, it's very nice. Unfortunately I'm so busy with classwork for the end of the semester that I don't have time to pick any C# and play with it at all


----------



## [I.R.A]_FBi (Dec 5, 2009)

ill try it later


----------



## Disparia (Dec 6, 2009)

Good stuff. If I had a little more practice in C#, would write a mouse (path finder) class


----------



## Disparia (Dec 6, 2009)

Who needs SuperPI? We have MazzBench!


----------



## Oliver_FF (Dec 6, 2009)

this looks cool, I'll give it a try next time I boot in to Windows


----------



## Kreij (Dec 6, 2009)

Jizzler said:


> Who needs SuperPI? We have MazzBench!
> 
> http://www.theburnerishot.com/photo/MazzBench.png



You gave it a purpose !!!


----------



## FordGT90Concept (Dec 7, 2009)

Jizzler said:


> Who needs SuperPI? We have MazzBench!
> 
> http://www.theburnerishot.com/photo/MazzBench.png


Is it multithreaded?


----------



## Disparia (Dec 7, 2009)

Lol, I was just reading a threading tutorial.


----------



## Kreij (Dec 7, 2009)

I've got some ideas to make this a little more interesting, but I haven't had any time to code in the last few days 

So I'll give you a little coding humor instead ...


----------



## Disparia (Dec 8, 2009)

I overclocked:






Then I multi-thread:






Hmm... need to optimize 

-edit-

After a little re-working, got them to ~100 each.


----------



## FordGT90Concept (Dec 8, 2009)

You should be able to average around 140 per core.  It should be done in right around 4 seconds on a dual-core or 2 seconds on a quad core for 1000 mazes.


----------



## Completely Bonkers (Dec 8, 2009)

Nice benchmark concept, but, would be better if you had a mouse and it had to solve the maze too! Or at least a fill routine, that coloured in each maze branch simultaneously. What is the best maze-solve algorithm?

What is your "random" generator for creating the maze? Random-random, or fractal-random? That might be interesting.

Oh, why isnt this in 3D? 
	

	
	
		
		

		
		
	


	








http://en.wikipedia.org/wiki/3D_Monster_Maze


----------



## FordGT90Concept (Dec 8, 2009)

The best maze solving algorithm would probably be based on a binary tree--a new leaf created every time a junction is encountered.


----------



## human_error (Dec 8, 2009)

Ooo this reminds me of when i had to write a maze generator for uni a few years ago in java - does your algorithm have the possibility of creating "islands" where a pathfinding algorithm which would use a take every right or take every left would be able to get trapped?

Also sorry if this may go off-topic but would anyone be interested in a 3D version (java+openGl) which has pre-made maps and a random maze generator? If you make a massive random maze it can drag even high-end rigs down in performance  I can upload mine if anyone's interested (graphics are very basic, but it has more than just a maze solving component as it was a fire fighting game).


----------



## Kreij (Dec 8, 2009)

Completely Bonkers said:


> Nice benchmark concept, but, would be better if you had a mouse and it had to solve the maze too! Or at least a fill routine, that coloured in each maze branch simultaneously. What is the best maze-solve algorithm?
> 
> What is your "random" generator for creating the maze? Random-random, or fractal-random? That might be interesting.
> 
> Oh, why isnt this in 3D?



This was just a quick little project to get the maze working. What I wanted to do eventually was get the maze working as needed and then import it into MS Robotic studio as a 3D maze and then allow people to write robot control routines to traverse the maze and see who could come up with good control routines for solving the maze.

That thought got sidelined when I realized it would be more fun to write this as a client server program where 4 people would make robots (1 in each corner) and see who could complete the maze (travel to the opposing diagonal corner) first. Of course the robots would be armed and could shoot each other when they met (killing a robot would send it back to its starting location forcing it to start over).


----------



## Completely Bonkers (Dec 8, 2009)

Sounds great! What would be cool would be such an "environment" with a logo-type scripting language so that people (teams) could program their own bots to wander and solve the maze and compete! BIG PROJECT though! Perhaps for a masters or PhD... collective community AI project.


----------



## Kreij (Dec 8, 2009)

Completely Bonkers said:


> BIG PROJECT though! Perhaps for a *masters or PhD*... collective community AI project.



BAH !! ... We could do it. It's not that hard, just time consuming.


----------



## FordGT90Concept (Dec 8, 2009)

You could just import .NET Framework DLLs for robot AI.  That's much easier and faster than coding a scripting language.


----------



## Kreij (Dec 8, 2009)

I think we need a TPU coding project.
Not sure what we would do , but it would be fun to get a group of us coding hobbyists together and create some kind of coding masterpiece.


----------



## Solaris17 (Dec 8, 2009)

Kreij said:


> I think we need a TPU coding project.
> Not sure what we would do , but it would be fun to get a group of us coding hobbyists together and create some kind of coding masterpiece.



that would be wicked fun. the problem is im not sure what we could do that would incorporate everyones area. as not everyone knows the others language.


----------

