Your job is to write a program that takes a number N as input and outputs all 2-by-N mazes that are solvable.
Output format can be in the form of any two distinct values representing wall and empty - I use x
and .
here but you can use anything. You can have a matrix, array, string, ascii art, whatever is convenient, and it can be horizontal, as shown in my examples, or vertical.
A maze is solvable if it has a path of empty cells (represented here as .
) from the left end to the right end. For example,
xxxx.....
.....x..x
is solvable, because you can trace a path (marked with O):
xxxxOOOOO
OOOOOx..x
But this is not.
xxx.x..
..xxx..
You cannot pass through diagonal gaps, so this is also not:
xxx...
...xxx
Testcases
1:
.
.
.
x
x
.
2:
..
..
..
.x
.x
..
..
x.
..
xx
x.
..
xx
..