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
4
votes
4 answers

How to check if a possible path exist?

I'm working on an experimental javascript-based game. Player has to travel to exit on a 2-dimensional tiled map. Feel free to check this fiddle and play I'm just randomly placing obstacles, but sometimes obstacles block the way between player and…
Aycan Yaşıt
  • 2,106
  • 4
  • 34
  • 40
4
votes
4 answers

Count distinct rectangular grid mazes with acyclical paths for given size

I was trying to solve the following problem: An mn maze is an mn rectangular grid with walls placed between grid cells such that there is exactly one path from the top-left square to any other square. The following are examples of a 912 maze and…
John Donn
  • 1,718
  • 2
  • 19
  • 45
4
votes
4 answers

Code Golf: Solve a Maze

Here's an interesting problem to solve in minimal amounts of code. I expect the recursive solutions will be most popular. We have a maze that's defined as a map of characters, where = is a wall, a space is a path, + is your starting point, and # is…
Matthew Iselin
  • 10,400
  • 4
  • 51
  • 62
4
votes
5 answers

Maze recursion solving StackOverflow error

I'm trying to solve a maze using recursion. It's declared Cell [][] maze. public class Cell { private Wall left; private Wall right; private Wall up; private Wall down; private boolean end; // Setters and getters not…
danny.lesnik
  • 18,479
  • 29
  • 135
  • 200
4
votes
4 answers

How to convert a maze to a Graph?

I am trying to convert a maze data structure into a graph. The maze is like a grid and some walls between cells. maze[8][8][4] is how the maze is represented. If maze[i][j][0] = 1 it means you can't go up from (i,j) if maze[i][j][1] = 1 it means you…
Salih Erikci
  • 5,076
  • 12
  • 39
  • 69
3
votes
3 answers

Maze Generation with Ruby

I have been working on polishing my Ruby skills lately and came across a nice snazzy presentation on maze generation. Presentation by Jamis Buck I would want to implement a couple of algorithms and then generate image files for the mazes. I am quite…
Nitish Upreti
  • 6,312
  • 9
  • 50
  • 92
3
votes
3 answers

Procedurally generating a maze without 'cycles'

I wanted to write an algorithm which could generate a 'maze' like structure within a closed room. [This is not a typical maze. I just want some walls here and there within the room.] The catch is that I don't want any 'cycles'. eg: I want…
3
votes
1 answer

Maze solver with DFS

I am trying to solve the maze using DFS algorithm.ORDER: West- North-South-East My output works in this logic Labyrinth picture1. It should not go up after the point (3,3),because the order of priority is west. What should I do? #include…
OceanWaves
  • 53
  • 9
3
votes
3 answers

How to find the shortest path in 2D maze array, by only hitting walls

I am struggling to implement an algorithm that resolves a 2D maze array by only changing a direction once a wall or another obstacle is hit. What it needs to do is, given the following array (where x is the start, 1 is an obstacle, g is the goal)…
feedy
  • 1,071
  • 5
  • 17
3
votes
2 answers

Who created the recursive division maze algorithm?

I am working on a project that uses a form of the recursive division algorithm that is normally used to create a fractal-like maze. Now I would like to cite the creator/author of this algorithm to give them credit, but I am unsure who invented…
Senca
  • 33
  • 5
3
votes
1 answer

Understanding a Ruby implementation of the recursive-backtracking algorithm

I am trying to understand a particular Ruby implementation of the recursive-backtracking algorithm which generates mazes: https://weblog.jamisbuck.org/2010/12/27/maze-generation-recursive-backtracking I have read up and (to some level at least)…
perrywinkle
  • 363
  • 3
  • 11
3
votes
2 answers

Finding all maze solutions with Python

I am trying to find (using Python) all possible solutions to a maze. I have a DFS script that returns one solution. I am trying to adapt it but I'm really having a hard time wrapping my head around the whole recursion thing. Here's the code I have,…
3
votes
1 answer

Character Moving off screen in Python / PyGame despite setting boundaries

Creating a game where a maze is randomly generated and the player must navigate from the top left to the bottom right of the maze. I have tried many things to stop my character going off-screen but it still doesn't work. When already on the boundary…
George G
  • 43
  • 4
3
votes
1 answer

Breadth-First Search takes way too long to solve maze

I have an big, open maze like…
Ibrahim
  • 85
  • 8
3
votes
1 answer

Recursion in a Tree-like Structure

As a school project I have to find the solution path in a maze using the backtracking method recursively, I usually have no problem solving algorithms with recursion, on linear problems, however when it comes of having multiple choices/paths to…
user7790873