Meet Mickey and Minerva, two clever mice who love to navigate their way through a maze to find cheese. They enjoy a good challenge, but with only their tiny mouse brains, they prefer if there is only one correct path to the cheese.
Your task is to generate the perfect mazes for Mickey and Minerva — those with only one solution and no isolated sections. Here's what you need to know:
x columns wide and y rows high should be 2x + 1 characters wide and 2y + 1 characters high.It's time to create some perfect mazes for these adventurous mice!
┌───────┬─┐
│ │ │
│ ┌─┬── │ │
│ │ │ │ ⇨
│ │ │ ──┤ │
⇨ │ │ │ │
┌─┤ └── │ │
│ │ │ │
│ │ ────┘ │
│ │
└─────────┘
┌───────────┬─────────┬───────────┬─┐
│ │ │ │ │
│ ┌───────┐ │ ┌─┐ ──┐ └───┐ ┌───┐ │ │
│ │ │ │ │ │ │ │ │ │ ⇨
│ └─┐ ┌─┐ │ │ │ ├── ├───┐ │ │ ──┼── │
│ │ │ │ │ │ │ │ │ │ │ │
└── │ │ ├───┴───┤ ┌─┘ ┌─┘ │ ├── │ ──┤
⇨ │ │ │ │ │ │ │ │ │
┌─┬─┴─┐ └─┐ ┌─┐ │ └─┐ │ ┌─┘ │ ──┴─┐ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ └── │ │ │ └── │ ──┘ ┌─┘ ──┐ │ │
│ │ │ │ │ │ │
└───┴───────┴───────┴─────┴─────┴───┘
Sign up to Exercism to learn and master AWK with 3 concepts92 exercises, and real human mentoring, all for free.