Questions tagged [maze]

A maze is a tour puzzle in the form of a complex branching passage.

A maze is a tour puzzle in the form of a complex branching passage through which the solver must find a route. The pathways and walls in a maze are fixed, and puzzles in which the walls and paths can change during the game are categorised as tour puzzles. The Cretan labyrinth is the oldest known maze.

Technically the maze is distinguished from the labyrinth, which has a single through-route with twists and turns but without branches, and is not designed to be as difficult to navigate. In everyday speech, both maze and labyrinth denote a complex and confusing series of pathways.

1093 questions
5
votes
1 answer

Python maze generator explanation

Welcome. Can someone explain me what happens in this code? I would like to know how exactly does this work (it comes from http://rosettacode.org/wiki/Maze_generation#Python). from random import shuffle, randrange def make_maze(w = 16, h = 8): …
mate317
  • 51
  • 1
  • 2
5
votes
2 answers

Random maze generator in C

I don't know how to make sure the random maze can lead from the entry on the right side to the exit on the left side without any wall block the path. This is my code I am doing so far. Can everybody give me a hint or algorithm to achieve the simple…
lee huy
  • 99
  • 1
  • 1
  • 8
5
votes
2 answers

Maze generation using DFS fails and I don't know why

I just wanted to generate some mazes using the easiest algorithm, but all my mazes look like the following one: Here is a piece of Java code (a whatVisit function works correct, don't look at it): private void dfs(Point start, boolean[][] visited)…
vortexxx192
  • 929
  • 1
  • 9
  • 24
5
votes
4 answers

Maze solving by image recognition

I'm trying to do a project with some of my friends, and we came upon that: Say I had to decipher this Labyrinth programmatically, how could I go on about that? My first decision when trying to solve labyrinths by image recognition is obviously…
ShizukaSM
  • 343
  • 2
  • 5
  • 15
5
votes
3 answers

Maze recursion - going wrong for few inputs (likely error in the logic)

I am a beginner in java. I have been working on an maze problem trying it solve it by recursion. I have written the code which seems to work on few inputs and not others. The input is a maze consisting of 0's and 1's. # is the start and @ is the…
5
votes
5 answers

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…
Serafina Brocious
  • 30,433
  • 12
  • 89
  • 114
5
votes
1 answer

Algorithm to print to screen path(s) through a text maze

For my C++ assignment, I'm basically trying to search through a chunk of text in a text file (that's streamed to my vector vec) beginning at the second top character on the left. It's for a text maze, where my program in the end is supposed to print…
forthewinwin
  • 4,455
  • 4
  • 19
  • 17
4
votes
2 answers

Finding the shortest path in a maze

I am amateur programmer learning how to program. I have never had any computer science courses so I have hard times with this trivial problem: class Room { String name; ArrayList neighbors = new ArrayList(); // constructor…
Nancy
  • 43
  • 3
4
votes
3 answers

Maze solving algorithm. Complex mazes

I found several algorithms to solve mazes. Those which are simple enough are suitable only in cases when exit is in outer boundary (Wall-follower, pledge...). Is there some more sophisticated algorithms for cases when shapes of boundaries are…
Sergey
  • 1,168
  • 2
  • 13
  • 28
4
votes
2 answers

Maze solver recording backtracked paths

I've gotten my maze solver program to work but it seems to be including back tracked spaces (places it went to and hit a wall so it had to turn around) in the final solution path that it outputs. Here is an example: How can I prevent this in my…
darko
  • 2,438
  • 8
  • 42
  • 54
4
votes
2 answers

Difficulties in converting an recursive algorithm into an iterative one

I've been trying to implement a recursive backtracking maze generation algorithm in javascript. These were done after reading a great series of posts on the topic here While the recursive version of the algorithm was a no brainer, the iterative…
danem
  • 1,495
  • 5
  • 19
  • 35
4
votes
1 answer

Connect nodes to neighbours via line of sight (straightline)

So I have a structure that is similar to a maze, but with much more open space. And for each node in the structure, I would like to find all it's 'neighbours' (nodes are neighbours if they are in line of sight, i.e no walls blocking the straight…
AstonKey
  • 71
  • 5
4
votes
1 answer

Bug in my recursive division algorithm (to generate maze randomly)

I'm having trouble generating a random maze. My algorithm creates the initial box where the maze will be. But I cannot seem to generate any walls inside of this box. I'm trying to use the recursive division algorithm. Here is my code: class Maze…
Beginner
  • 43
  • 3
4
votes
1 answer

A* path finding algo gives path but it's not the shortest path

I am trying to implement a* pathfinding in my program, but it is returning the following output. Here is the output image In the image blue blocks are visited blocks, the one with circles are yet to visit blocks and the yellow blocks are path…
4
votes
4 answers

Getting X & Y dimensions from given txt file

I uploaded a txt file (a maze) to my code in Python. Example: 10 8 +-+-+-+-+-+-+-+-+-+-+ |* | | + +-+-+ + +-+ + + | | |X | | +-+ + +-+ +-+-+ + | | | | +-+-+-+-+ + + +-+ + | | | | | +…
Jiana
  • 87
  • 1
  • 5