-
-
Notifications
You must be signed in to change notification settings - Fork 555
Mazy Mice #2312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rabestro
wants to merge
16
commits into
exercism:main
Choose a base branch
from
rabestro:mazy-mice
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Mazy Mice #2312
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
354f507
Add Mazy Mice Exercise to the Repository
c78b29a
Refactor Mazy Mice description format for better readability
1879adf
Merge branch 'main' into mazy-mice
9175bb5
Update test case comments in mazy-mice exercise
1f5546c
Correct indentation in maze diagrams
fa8427d
Update section heading levels in mazy-mice description
181ece6
Corrected the positioning of Box-drawing link in mazy-mice description
c75cd3e
Add additional test cases to Mazy Mice exercise
45bb301
Correct casing and formatting in description.md
5cab22d
Update expected results format in canonical-data.json
416803e
Merge branch 'exercism:main' into mazy-mice
rabestro 63ce221
Update exercise metadata and add validation for maze dimensions
ee71139
Add introduction for Mazy Mice exercise
33ff1b8
Simplify and restructure maze instructions.
a75fe77
Remove unused link reference from instructions
2e81bf1
Update exercises/mazy-mice/introduction.md
rabestro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
{ | ||
"exercise": "mazy-mice", | ||
"comments": [ | ||
"The following checks should be considered: ", | ||
" ", | ||
"The dimensions of the maze are correct: ", | ||
" - the number of lines is equal to rows * 2 + 1 ", | ||
" - the width of each line in characters is equal to columns * 2 + 1", | ||
"The maze contains only valid characters. ", | ||
"The maze has a single entrance on the left side. ", | ||
"The maze has a single exit on the right side. ", | ||
"The maze is perfect: ", | ||
" - there is a single path from the entrance to the exit ", | ||
" - there are no loops in the maze ", | ||
" - there are no inaccessible sections in the maze ", | ||
"The maze is random: ", | ||
" - the maze is different each time it is generated ", | ||
" - the maze is the same if the same seed is used ", | ||
" - two mazes with different seeds should not be equal ", | ||
"The rows and cols must be between 5 and 100 " | ||
], | ||
"cases": [ | ||
{ | ||
"uuid": "e01f6db6-613c-4b55-9c09-e87edc0b04dd", | ||
"description": "The dimensions of the maze are correct", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 6, | ||
"cols": 18 | ||
}, | ||
"expected": { | ||
"width": 37, | ||
"height": 13 | ||
} | ||
}, | ||
{ | ||
"uuid": "4782cea6-a1e3-48b2-b825-a805890b5118", | ||
"description": "The maze contains only valid characters", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 6, | ||
"cols": 18 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "1433a6ff-d18e-4ade-b37c-40b286218f07", | ||
"description": "The maze has a single entrance on the left side", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 6, | ||
"cols": 18 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "a0be2a1c-4ec1-412a-8a30-36d6b1d96df2", | ||
"description": "The maze has a single exit on the right side", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 6, | ||
"cols": 18 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "1f7f50f5-4a3a-4e96-8c5e-92b284fd8b3b", | ||
"description": "the smallest square maze is perfect", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 5, | ||
"cols": 5 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "2a8e8f63-7e89-4c9a-8d1f-1439a7d9a3e9", | ||
"description": "the small rectangular maze is perfect", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 5, | ||
"cols": 10 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "3b6e8d5c-2a8d-4f03-9e7a-6c8f2a4e4f88", | ||
"description": "the square maze is perfect", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 10, | ||
"cols": 10 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "4c7f6e5b-5e45-4a8d-8e8a-7f3e3e4e5f99", | ||
"description": "the large rectangular maze is perfect", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 10, | ||
"cols": 20 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "5d8f7f6c-6e46-4a9d-8e8b-8f3f3f4e6f00", | ||
"description": "the rectangular maze with aspect 2:1 is perfect", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 20, | ||
"cols": 10 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "6e9f8f7d-7e47-4a9e-8e8c-9f3f3f4e7f01", | ||
"description": "the huge rectangular maze is perfect", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 20, | ||
"cols": 100 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "7fa0a0b1-8e48-4a9f-8e8d-af4f4f5e8f02", | ||
"description": "the huge square maze is perfect", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 100, | ||
"cols": 100 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "8fb1c1d2-9e49-4aa0-8e8e-bf5f5f6e9f03", | ||
"description": "if the seed parameter is specified, the perfect maze generated", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 50, | ||
"cols": 50, | ||
"seed": 2342342 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "9fc2d2e3-af4a-4ab1-8e8f-cf6f6f7eaf04", | ||
"description": "if the seed parameter is omitted, random mazes should be generated", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 8, | ||
"cols": 16 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "a0d3e4f4-b05b-4ac2-8e8a-df7f7f8eaf05", | ||
"description": "if the seed parameter is specified, the same maze should be generated", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 8, | ||
"cols": 16, | ||
"seed": 123 | ||
}, | ||
"expected": true | ||
}, | ||
{ | ||
"uuid": "b2f1a0e5-1c3a-4d5e-9f2b-8a7b6c5d4e3f", | ||
"description": "Error: rows less than 5", | ||
"property": "generateMaze", | ||
"input": { | ||
"rows": 4, | ||
"cols": 10 | ||
}, | ||
"expected": { | ||
"error": "rows must be between 5 and 100" | ||
} | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# 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: | ||
|
||
- The maze has a rectangular shape with an opening at the start and end. | ||
- The maze has rooms and passages, which intersect at right angles. | ||
- The program should accept two parameters: rows and columns. The maze should be between 5 and 100 cells in size. | ||
- A maze which is `x` columns wide and `y` rows high should be `2x + 1` characters wide and `2y + 1` characters high. | ||
- If no seed is provided, generate a random maze. If the same seed is provided multiple times, the resulting maze should be the same each time. | ||
|
||
It's time to create some perfect mazes for these adventurous mice! | ||
|
||
## Examples | ||
|
||
The small square maze 5x5 cells (or 11x11 characters) | ||
|
||
```text | ||
┌───────┬─┐ | ||
│ │ │ | ||
│ ┌─┬── │ │ | ||
│ │ │ │ ⇨ | ||
│ │ │ ──┤ │ | ||
⇨ │ │ │ │ | ||
┌─┤ └── │ │ | ||
│ │ │ │ | ||
│ │ ────┘ │ | ||
│ │ | ||
└─────────┘ | ||
``` | ||
|
||
The rectangular maze 6x18 cells | ||
|
||
```text | ||
┌───────────┬─────────┬───────────┬─┐ | ||
│ │ │ │ │ | ||
│ ┌───────┐ │ ┌─┐ ──┐ └───┐ ┌───┐ │ │ | ||
│ │ │ │ │ │ │ │ │ │ ⇨ | ||
│ └─┐ ┌─┐ │ │ │ ├── ├───┐ │ │ ──┼── │ | ||
│ │ │ │ │ │ │ │ │ │ │ │ | ||
└── │ │ ├───┴───┤ ┌─┘ ┌─┘ │ ├── │ ──┤ | ||
⇨ │ │ │ │ │ │ │ │ │ | ||
┌─┬─┴─┐ └─┐ ┌─┐ │ └─┐ │ ┌─┘ │ ──┴─┐ │ | ||
│ │ │ │ │ │ │ │ │ │ │ │ | ||
│ │ │ └── │ │ │ └── │ ──┘ ┌─┘ ──┐ │ │ | ||
│ │ │ │ │ │ │ | ||
└───┴───────┴───────┴─────┴─────┴───┘ | ||
``` | ||
|
||
## Hints | ||
|
||
### Maze generation | ||
|
||
You can use any algorithm to generate a perfect maze. The [recursive backtracker][recursive-backtracker] is a good choice. | ||
|
||
[recursive-backtracker]: https://en.wikipedia.org/wiki/Maze_generation_algorithm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# 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 is only one correct path to the cheese. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
title = "Mazy Mice" | ||
blurb = "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." | ||
source = "Inspired by the 'Maze Generator' created by Jan Boström at Alance AB." | ||
source_url = "https://mazegenerator.net/" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still some wide arrows in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if I understood correctly we can keep UTF-8 symbols in description for information (illustration) purposes. The illustration rendered correctly for this exercise (AWK and Java tracks). I've deleted the table with symbols as mentioned by @ErikSchierboom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you mean it's rendered correctly on the website? That's not the only place where people will see it. It's rendered badly here on GitHub and it will be rendered badly in all the various editors people use locally. It's kind of a minor thing but I don't see the benefit of using a fancy arrow symbol in ascii art instead of just
>
,->
or=>
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the past i've used this one
➜
in some of my PRs and it seems to be rendered fine in editors and the website.