maze

What's a good algorithm to generate a maze?

Say you want a simple maze on an N by M grid, with one path through, and a good number of dead ends, but that looks "right" (i.e. like someone made it by hand without too many little tiny dead ends and all that). Is there a known way to do this? ...

How to traverse a maze programatically when you've hit a dead end.

Moving through the maze forward is pretty easy, but I can't seem to figure out how to back up through the maze to try a new route once you hit a dead end without going back too far? ...

Optimal multiplayer maze generation algorithm

I'm working on a simple multiplayer game in which 2-4 players are placed at separate entrypoints in a maze and need to reach a goal point. Generating a maze in general is very easy, but in this case the goal of the game is to reach the goal before everyone else and I don't want the generation algorithm to drastically favor one player ov...

How can I create cells or grids in C++ for a randomized maze?

I'm trying to create a randomized maze in C++, but I can't start because I don't know how to create grids or cells. How could I create it? And I also want to create it using ASCII characters. how can i store it in array? (can any one give a sample code and some explanation so i can understand it better) Another question: What data stuct...

Creating a Maze class in C++ using 16bit unsigned int array?

I'm attempting to make a data structure to represent a Maze in C++. All the data I need to hold about the maze can be stored in 16 bit integers using bitwise operations (to represent each cell of the maze): 16 bit unsigned integer So, I figured a 2d array of 16bit integers and I'm good to go for my Maze data structure. I wanted to ke...

Pacman maze in Java

So I'm building the pacman game in Java to teach myself game programming. I have the basic game window with the pacman sprite and the ghost sprites drawn, the pacman moves with the arrow keys, doesn't move beyond the walls of the window, etc. Now I'm trying to build the maze, as in this picture: Without giving me the direct/complete ...

Problem with Maze Algorithm

I am having a problem with a algorithm that is designed to solve mazes. I used an algorithm from here.http://www.cs.bu.edu/teaching/alg/maze/ FIND-PATH(x, y) if (x,y outside maze) return false if (x,y is goal) return true if (x,y not open) return false mark x,y as part of solution path if (FIND-PATH(North of x,y) == true) return true...

How to find all available maze paths?

I am trying to write a program that is given a maze and tries to find the way out. M is the entrance, E is the exit, 1s are walls, and 0s are pathways. It is supposed to find each path and put P in the path. It is supposed to find all available paths. Right now it finds part of a path. Here is the code: public class Maze { private...

Reading in an ascii 'maze' into a 2d array

I'm writing code to read in a 7x15 block of text in a file that will represent a 'maze'. #include <iostream> #include <fstream> #include <string> #include "board.h" int main() { char charBoard[7][15]; //the array we will use to scan the maze and modify it ifstream loadMaze("maze"); //the fstream we will use to take in a maze...

How can I clean up this method I wrote in Java?

I'm working on writing a Maze generator. I have a "Cell" class which is as follows: public class Cell { public boolean northWall; public boolean southWall; public boolean eastWall; public boolean westWall; public Cell north; public Cell south; public Cell east; public Cell west; public boolean visi...

How could I stop from printing both sides of a wall in my ascii maze?

I've written some code that generates mazes for me. The maze consists of (n x n) cells, each cell has a boolean value to represent a wall (north, south, east west). It is working fine, and I wrote the function below to print out the maze: public static void printMaze(Cell[][] maze) { for(int i = 0; i < maze.length; i++) ...

Maze recursive solving and randomly creating a maze (JAVA)

first assignment was a find the solution of a 12*12 maze. i am supposed to use a recursive method to solve them. secondly, i have to make a method to create a randomly generated maze with same dimensions. (# represents a wall, * represents a untraveled path, T represents a traveled path, X represents a path that leads to a dead end) im s...

Java: Implementing a drawable class

I'm trying to make a maze game in Java. The Explorer class represents the user, and the DrawableExplorer is the code that graphically represents the user. DrawableExplorer implements the Drawable interface which contains: import java.awt.Graphics; public abstract interface Drawable { public abstract void draw(Graphic...

How to create a maze (labyrinth) in NetLogo?

I am new to NetLogo software and I am trying to create a 5x5 grid with 2 exits and put some walls in it (in other words i want to create a maze or a labyrinth). I was wondering if there is a way to make thicker or change the colour of only the side and not the whole patch. I want to put only one agent inside and let him find the exit b...

Rendering a random generated maze in WinForms.NET

Hi I'm trying to create a maze-generator, and for this I have implemented the Randomized Prim's Algorithm in C#. However, the result of the generation is invalid. I can't figure out if it's my rendering, or the implementation that's invalid. So for starters, I'd like to have someone take a look at the implementation: maze is a matrix ...

Algorithm to generate a segment maze

I want to generate a maze that looks like this: That is, it consists of paths in one direction that are then connected. I have looked for an algorithm to generate mazes like this without success. Specifically, I don't want a maze like this: because it doesn't "run" in only one direction. Also, it would be nice if the solution of t...

Creating a Maze using Java

Im using Java to create a maze of specified "rows" and "columns" over each other to look like a grid. I plan to use a depth-first recursive method to "open the doors" between the rooms (the box created by the rows and columns). I need help writing a openDoor method that will break the link between rooms. ...

Programming theory: Solve a maze

Hey, What are the possible ways to solve a maze? Ive got two ideas, but I think they are not very elegant. Base situation: We have a matrix, and the elements in this matrix are ordered in a way that it represents a maze, with one way in, and one out. My first idea was to send a robot through the maze, following one side, until it's ou...

solve a maze by using DFS, BFS, A*

I want to know the change in results when we use open maze or closed maze for the DFS, BFS, and A* search algorithms? Is there any big difference in the output like increase in number of expanded nodes, cost, etc.? ...

shortest path through a maze

I am working on a project that i must traverse a maze using the left-hand rule and based upon the intersections the program comes upon i need to create a node to connect to a graph that I will then determine the shortest path. The goal is for the program to run through the maze then close out the program and read from a file that contain...