12
1
Given an odd integer N (5 <= N <= 51), generate a maze with side length N that follows the following requirements:
The maze must be composed of the characters
|
-
and +
. It must use the |
character as a vertical wall, the -
character as a horizontal wall, and if that wall turns, the character +
should be used.
The width of the path must be one character.
The maze must turn at least four times.
The maze must have outer walls, that break at two points: the start and the end.
The maze must consist of one non-breaking path, from the start to the end.
For example, the following is a valid maze: (N = 5)
+---+
| |
| | |
|
--+--
And for N = 7:
--+---+
| |
| | | |
| | | |
| | | |
| |
+---+--
Remember, this is code-golf, so the code with the fewest number of bytes wins.
9
It's not a maze, it's a labyrinth http://english.stackexchange.com/a/144103/199361
– edc65 – 2016-10-30T20:54:51.333@edc65 Actually, its nighter. – Oliver Ni – 2016-10-30T21:23:03.433
I'm not clear on "The maze must consist of one non-breaking path, from the start to the end." Does this mean that there is only one-path and it's from start to end, or that the number of paths from start to end is 1? Can there be other paths with dead ends? Separate loops? – xnor – 2016-10-30T22:39:24.797
Odd integer should be <50, <=49 – pinkfloydx33 – 2016-10-31T00:41:18.817
2@edc65 I assume OP means neither. – orlp – 2016-10-31T10:15:05.930
@edc65 Welcome to [tag:labyrinth]! – Erik the Outgolfer – 2016-10-31T17:29:04.257
Do both the width AND height have to be size
N
? I could comply to all your specified requirements, but only have either one sizeN
and the other not. – Kevin Cruijssen – 2016-11-10T07:49:53.243@KevinCruijssen Yes. – Oliver Ni – 2016-11-10T15:23:09.233