exercism / awk

Exercism exercises in AWK.
https://exercism.org/tracks/awk
MIT License
18 stars 21 forks source link

Exercise: Mazy Mice #211

Closed rabestro closed 1 year ago

rabestro commented 1 year ago

Introduction

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's only one correct path to the cheese.

Instructions

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:

It's time to create some perfect mazes for these adventurous mice!

Examples

  1. The smallest square maze 5x5 cells (or 11x11 characters)
    ┌───────┬─┐
    │       │ │
    │ ┌─┬── │ │
    │ │ │   │ ⇨
    │ │ │ ──┤ │
    ⇨ │ │   │ │
    ┌─┤ └── │ │
    │ │     │ │
    │ │ ────┘ │
    │         │
    └─────────┘
  2. The rectangular maze 6x18 cells
    ┌───────────┬─────────┬───────────┬─┐
    │           │         │           │ │
    │ ┌───────┐ │ ┌─┐ ──┐ └───┐ ┌───┐ │ │
    │ │       │ │ │ │   │     │ │   │   ⇨
    │ └─┐ ┌─┐ │ │ │ ├── ├───┐ │ │ ──┼── │
    │   │ │ │   │   │   │   │ │ │   │   │
    └── │ │ ├───┴───┤ ┌─┘ ┌─┘ │ ├── │ ──┤
    ⇨   │   │       │ │   │   │ │   │   │
    ┌─┬─┴─┐ └─┐ ┌─┐ │ └─┐ │ ┌─┘ │ ──┴─┐ │
    │ │   │   │ │ │ │   │   │   │     │ │
    │ │ │ └── │ │ │ └── │ ──┘ ┌─┘ ──┐ │ │
    │   │       │       │     │     │   │
    └───┴───────┴───────┴─────┴─────┴───┘

Hints

General

Maze generation

You can use any algorithm to generate a perfect maze. The recursive backtracker is a good choice.

Box drawing characters

Character Name Unicode
box drawings light down and right U+250C
box drawings light horizontal U+2500
box drawings light down and horizontal U+252C
box drawings light down and left U+2510
box drawings light vertical U+2502
box drawings light up and right U+2514
box drawings light up and horizontal U+2534
box drawings light up and left U+2518
box drawings light vertical and right U+2520
rightwards white arrow U+21E8
iHiD commented 1 year ago

Thanks! :)

FYI, @glennj will probably want to review this, and he's away on holiday for the next two weeks.

(Also cc @ErikSchierboom)

ErikSchierboom commented 1 year ago

https://exercism.org/docs/building/tracks/practice-exercises can be helpful

rabestro commented 1 year ago
rabestro commented 1 year ago

https://exercism.org/docs/building/tracks/practice-exercises can be helpful

Thank you for the link. I need some time to learn it :)

ErikSchierboom commented 1 year ago

@rabestro I'll let @IsaacG and @glennj handle the further reviewing of this PR

rabestro commented 1 year ago

Hi @glennj , @IsaacG. I hope that I have resolved all the comments.

glennj commented 1 year ago

@IsaacG did you want another look at this?

rabestro commented 1 year ago

Looks good! Thanks for doing this. I have some minor word-smithing suggestions.

fixed

glennj commented 1 year ago

Many thanks for persevering @rabestro!