From 354f507ee7fdf77ee7791e1d0477c7e46e4ac7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jegors=20=C4=8Cemisovs?= Date: Fri, 1 Sep 2023 16:57:10 +0300 Subject: [PATCH 1/9] Add Mazy Mice Exercise to the Repository This commit introduces a new exercise named 'Mazy Mice'. The exercise is designed to implement a maze generator that produces perfect mazes, i.e., mazes that have only one correct path, without any isolated sections. User must also adhere to the restrictions about the maze's size and layout depicted in the problem description. Tasks also include a description of how the mazes should be visually represented. The commit also includes canonical data for testing the described functionality. --- exercises/mazy-mice/canonican-data.json | 110 ++++++++++++++++++++++++ exercises/mazy-mice/description.md | 76 ++++++++++++++++ exercises/mazy-mice/metadata.toml | 4 + 3 files changed, 190 insertions(+) create mode 100644 exercises/mazy-mice/canonican-data.json create mode 100644 exercises/mazy-mice/description.md create mode 100644 exercises/mazy-mice/metadata.toml diff --git a/exercises/mazy-mice/canonican-data.json b/exercises/mazy-mice/canonican-data.json new file mode 100644 index 0000000000..db21a4c59e --- /dev/null +++ b/exercises/mazy-mice/canonican-data.json @@ -0,0 +1,110 @@ +{ + "exercise": "maze", + "comments": [ + "Test cases for generating perfect mazes for Mickey and Minerva" + ], + "cases": [ + { + "uuid": "1f7f50f5-4a3a-4e96-8c5e-92b284fd8b3b", + "description": "the smallest square maze is perfect", + "property": "createMaze", + "input": { + "rows": 5, + "cols": 5 + }, + "expected": "The maze is perfect." + }, + { + "uuid": "2a8e8f63-7e89-4c9a-8d1f-1439a7d9a3e9", + "description": "the small rectangular maze is perfect", + "property": "createMaze", + "input": { + "rows": 5, + "cols": 10 + }, + "expected": "The maze is perfect." + }, + { + "uuid": "3b6e8d5c-2a8d-4f03-9e7a-6c8f2a4e4f88", + "description": "the square maze is perfect", + "property": "createMaze", + "input": { + "rows": 10, + "cols": 10 + }, + "expected": "The maze is perfect." + }, + { + "uuid": "4c7f6e5b-5e45-4a8d-8e8a-7f3e3e4e5f99", + "description": "the large rectangular maze is perfect", + "property": "createMaze", + "input": { + "rows": 10, + "cols": 20 + }, + "expected": "The maze is perfect." + }, + { + "uuid": "5d8f7f6c-6e46-4a9d-8e8b-8f3f3f4e6f00", + "description": "the rectangular maze with aspect 2:1 is perfect", + "property": "createMaze", + "input": { + "rows": 20, + "cols": 10 + }, + "expected": "The maze is perfect." + }, + { + "uuid": "6e9f8f7d-7e47-4a9e-8e8c-9f3f3f4e7f01", + "description": "the huge rectangular maze is perfect", + "property": "createMaze", + "input": { + "rows": 20, + "cols": 100 + }, + "expected": "The maze is perfect." + }, + { + "uuid": "7fa0a0b1-8e48-4a9f-8e8d-af4f4f5e8f02", + "description": "the huge square maze is perfect", + "property": "createMaze", + "input": { + "rows": 100, + "cols": 100 + }, + "expected": "The maze is perfect." + }, + { + "uuid": "8fb1c1d2-9e49-4aa0-8e8e-bf5f5f6e9f03", + "description": "if the seed parameter is specified, the perfect maze generated", + "property": "createMaze", + "input": { + "rows": 50, + "cols": 50, + "seed": 2342342 + }, + "expected": "The maze is perfect." + }, + { + "uuid": "9fc2d2e3-af4a-4ab1-8e8f-cf6f6f7eaf04", + "description": "if the seed parameter is omitted, random mazes should be generated", + "property": "createMaze", + "input": { + "rows": 8, + "cols": 16 + }, + "expected": "The random maze is generated." + }, + { + "uuid": "a0d3e4f4-b05b-4ac2-8e8a-df7f7f8eaf05", + "description": "if the seed parameter is specified, the same maze should be generated", + "property": "createMaze", + "input": { + "rows": 8, + "cols": 16, + "seed": 123 + }, + "expected": "The same maze is generated." + } + ] +} diff --git a/exercises/mazy-mice/description.md b/exercises/mazy-mice/description.md new file mode 100644 index 0000000000..3c6be34f1a --- /dev/null +++ b/exercises/mazy-mice/description.md @@ -0,0 +1,76 @@ +# Description + +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. + +## 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. +- Use [box-drawing][Box-drawing] characters to draw walls, and an arrow symbol (⇨) for the entrance on the left and exit on the right. + +It's time to create some perfect mazes for these adventurous mice! + +### Examples + +1. The small square maze 5x5 cells (or 11x11 characters) +```text + ┌───────┬─┐ + │ │ │ + │ ┌─┬── │ │ + │ │ │ │ ⇨ + │ │ │ ──┤ │ + ⇨ │ │ │ │ + ┌─┤ └── │ │ + │ │ │ │ + │ │ ────┘ │ + │ │ + └─────────┘ +``` +2. The rectangular maze 6x18 cells +```text + ┌───────────┬─────────┬───────────┬─┐ + │ │ │ │ │ + │ ┌───────┐ │ ┌─┐ ──┐ └───┐ ┌───┐ │ │ + │ │ │ │ │ │ │ │ │ │ ⇨ + │ └─┐ ┌─┐ │ │ │ ├── ├───┐ │ │ ──┼── │ + │ │ │ │ │ │ │ │ │ │ │ │ + └── │ │ ├───┴───┤ ┌─┘ ┌─┘ │ ├── │ ──┤ + ⇨ │ │ │ │ │ │ │ │ │ + ┌─┬─┴─┐ └─┐ ┌─┐ │ └─┐ │ ┌─┘ │ ──┴─┐ │ + │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ └── │ │ │ └── │ ──┘ ┌─┘ ──┐ │ │ + │ │ │ │ │ │ │ + └───┴───────┴───────┴─────┴─────┴───┘ +``` + +[Box-drawing]: https://en.wikipedia.org/wiki/Box-drawing_character + +# Hints + +## Maze generation + +You can use any algorithm to generate a perfect maze. The [recursive backtracker][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 | + + +[recursive-backtracker]: https://en.wikipedia.org/wiki/Maze_generation_algorithm diff --git a/exercises/mazy-mice/metadata.toml b/exercises/mazy-mice/metadata.toml new file mode 100644 index 0000000000..442b728673 --- /dev/null +++ b/exercises/mazy-mice/metadata.toml @@ -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/" From c78b29abbbd4fd1129f57efae7b6538e464d0a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jegors=20=C4=8Cemisovs?= Date: Fri, 1 Sep 2023 17:02:29 +0300 Subject: [PATCH 2/9] Refactor Mazy Mice description format for better readability Adjusted the format of the 'Mazy Mice' exercise description to enhance legibility. Added separate lines before the maze example sections to clearly differentiate them from the surrounding text. These changes improve the user's reading experience, making it easier for them to understand the task. --- exercises/mazy-mice/description.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exercises/mazy-mice/description.md b/exercises/mazy-mice/description.md index 3c6be34f1a..a5005afe12 100644 --- a/exercises/mazy-mice/description.md +++ b/exercises/mazy-mice/description.md @@ -19,6 +19,7 @@ It's time to create some perfect mazes for these adventurous mice! ### Examples 1. The small square maze 5x5 cells (or 11x11 characters) + ```text ┌───────┬─┐ │ │ │ @@ -32,7 +33,9 @@ It's time to create some perfect mazes for these adventurous mice! │ │ └─────────┘ ``` + 2. The rectangular maze 6x18 cells + ```text ┌───────────┬─────────┬───────────┬─┐ │ │ │ │ │ From 9175bb51b5d4d3c522d8a563b6f6d698e5e3e4b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jegors=20=C4=8Cemisovs?= Date: Sun, 17 Sep 2023 18:06:09 +0300 Subject: [PATCH 3/9] Update test case comments in mazy-mice exercise Expanded the comment section in the canonical-data.json file for the "mazy-mice" exercise to provide a more detailed guideline on the required checks for a generated maze. These include confirming correct maze dimensions, valid character use, singular entrance and exit, perfection of the maze and its randomness. --- exercises/mazy-mice/canonican-data.json | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/exercises/mazy-mice/canonican-data.json b/exercises/mazy-mice/canonican-data.json index db21a4c59e..bf2b502032 100644 --- a/exercises/mazy-mice/canonican-data.json +++ b/exercises/mazy-mice/canonican-data.json @@ -1,7 +1,22 @@ { "exercise": "maze", "comments": [ - "Test cases for generating perfect mazes for Mickey and Minerva" + "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 " ], "cases": [ { From 1f5546cc73e437903718ebfe255f171400c7ce58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jegors=20=C4=8Cemisovs?= Date: Sun, 17 Sep 2023 20:02:12 +0300 Subject: [PATCH 4/9] Correct indentation in maze diagrams Indentation in the maze diagrams within the mazy-mice exercise was inconsistent. The changes ensure tabs are uniformly used for all lines to improve readability and consistency in presentation. --- exercises/mazy-mice/description.md | 48 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/exercises/mazy-mice/description.md b/exercises/mazy-mice/description.md index a5005afe12..49d1abd35f 100644 --- a/exercises/mazy-mice/description.md +++ b/exercises/mazy-mice/description.md @@ -21,35 +21,35 @@ It's time to create some perfect mazes for these adventurous mice! 1. The small square maze 5x5 cells (or 11x11 characters) ```text - ┌───────┬─┐ - │ │ │ - │ ┌─┬── │ │ - │ │ │ │ ⇨ - │ │ │ ──┤ │ - ⇨ │ │ │ │ - ┌─┤ └── │ │ - │ │ │ │ - │ │ ────┘ │ - │ │ - └─────────┘ + ┌───────┬─┐ + │ │ │ + │ ┌─┬── │ │ + │ │ │ │ ⇨ + │ │ │ ──┤ │ + ⇨ │ │ │ │ + ┌─┤ └── │ │ + │ │ │ │ + │ │ ────┘ │ + │ │ + └─────────┘ ``` 2. The rectangular maze 6x18 cells ```text - ┌───────────┬─────────┬───────────┬─┐ - │ │ │ │ │ - │ ┌───────┐ │ ┌─┐ ──┐ └───┐ ┌───┐ │ │ - │ │ │ │ │ │ │ │ │ │ ⇨ - │ └─┐ ┌─┐ │ │ │ ├── ├───┐ │ │ ──┼── │ - │ │ │ │ │ │ │ │ │ │ │ │ - └── │ │ ├───┴───┤ ┌─┘ ┌─┘ │ ├── │ ──┤ - ⇨ │ │ │ │ │ │ │ │ │ - ┌─┬─┴─┐ └─┐ ┌─┐ │ └─┐ │ ┌─┘ │ ──┴─┐ │ - │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ └── │ │ │ └── │ ──┘ ┌─┘ ──┐ │ │ - │ │ │ │ │ │ │ - └───┴───────┴───────┴─────┴─────┴───┘ + ┌───────────┬─────────┬───────────┬─┐ + │ │ │ │ │ + │ ┌───────┐ │ ┌─┐ ──┐ └───┐ ┌───┐ │ │ + │ │ │ │ │ │ │ │ │ │ ⇨ + │ └─┐ ┌─┐ │ │ │ ├── ├───┐ │ │ ──┼── │ + │ │ │ │ │ │ │ │ │ │ │ │ + └── │ │ ├───┴───┤ ┌─┘ ┌─┘ │ ├── │ ──┤ + ⇨ │ │ │ │ │ │ │ │ │ + ┌─┬─┴─┐ └─┐ ┌─┐ │ └─┐ │ ┌─┘ │ ──┴─┐ │ + │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ └── │ │ │ └── │ ──┘ ┌─┘ ──┐ │ │ + │ │ │ │ │ │ │ + └───┴───────┴───────┴─────┴─────┴───┘ ``` [Box-drawing]: https://en.wikipedia.org/wiki/Box-drawing_character From fa8427d290e21e4e1d51ac396c47e73e65bd4a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jegors=20=C4=8Cemisovs?= Date: Sun, 17 Sep 2023 20:06:18 +0300 Subject: [PATCH 5/9] Update section heading levels in mazy-mice description Headings levels in the "mazy-mice/description.md" were adjusted for better organization. '# Hints' was changed to '## Hints' and '## Maze generation' and '## Box drawing characters' changed to '###'. This allows for an improved logical hierarchy and readability of the document. --- exercises/mazy-mice/description.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/exercises/mazy-mice/description.md b/exercises/mazy-mice/description.md index 49d1abd35f..1519001130 100644 --- a/exercises/mazy-mice/description.md +++ b/exercises/mazy-mice/description.md @@ -18,7 +18,7 @@ It's time to create some perfect mazes for these adventurous mice! ### Examples -1. The small square maze 5x5 cells (or 11x11 characters) +The small square maze 5x5 cells (or 11x11 characters) ```text ┌───────┬─┐ @@ -34,7 +34,7 @@ It's time to create some perfect mazes for these adventurous mice! └─────────┘ ``` -2. The rectangular maze 6x18 cells +The rectangular maze 6x18 cells ```text ┌───────────┬─────────┬───────────┬─┐ @@ -54,13 +54,13 @@ It's time to create some perfect mazes for these adventurous mice! [Box-drawing]: https://en.wikipedia.org/wiki/Box-drawing_character -# Hints +## Hints -## Maze generation +### Maze generation You can use any algorithm to generate a perfect maze. The [recursive backtracker][recursive-backtracker] is a good choice. -## Box drawing characters +### Box drawing characters | Character | Name | Unicode | |:---------:|:--------------------------------------|:--------| @@ -75,5 +75,4 @@ You can use any algorithm to generate a perfect maze. The [recursive backtracker | ├ | box drawings light vertical and right | U+2520 | | ⇨ | rightwards white arrow | U+21E8 | - [recursive-backtracker]: https://en.wikipedia.org/wiki/Maze_generation_algorithm From 181ece6d8842d7965cf3c9b627bf0f2d61537c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jegors=20=C4=8Cemisovs?= Date: Sun, 17 Sep 2023 20:09:14 +0300 Subject: [PATCH 6/9] Corrected the positioning of Box-drawing link in mazy-mice description Removed the Box-drawing reference link from the code block area to the bottom of the document under the "Maze generation" section. This change was proposed to enhance the readability of the document and provide the link at a more appropriate location. --- exercises/mazy-mice/description.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exercises/mazy-mice/description.md b/exercises/mazy-mice/description.md index 1519001130..b96775b997 100644 --- a/exercises/mazy-mice/description.md +++ b/exercises/mazy-mice/description.md @@ -52,8 +52,6 @@ The rectangular maze 6x18 cells └───┴───────┴───────┴─────┴─────┴───┘ ``` -[Box-drawing]: https://en.wikipedia.org/wiki/Box-drawing_character - ## Hints ### Maze generation @@ -76,3 +74,4 @@ You can use any algorithm to generate a perfect maze. The [recursive backtracker | ⇨ | rightwards white arrow | U+21E8 | [recursive-backtracker]: https://en.wikipedia.org/wiki/Maze_generation_algorithm +[Box-drawing]: https://en.wikipedia.org/wiki/Box-drawing_character From c75cd3efd76048284b116c608e41fc3ad5c32e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jegors=20=C4=8Cemisovs?= Date: Sun, 17 Sep 2023 20:28:00 +0300 Subject: [PATCH 7/9] Add additional test cases to Mazy Mice exercise Expanded test coverage for the 'generateMaze' functionality in the Mazy Mice exercise. This includes tests for maze dimensions, character validity, maze entrance and exit, and more. Additionally, replaced 'createMaze' with 'generateMaze' in existing test cases to ensure consistency. These changes aim to provide a more comprehensive evaluation of the generateMaze function's correctness and robustness. --- exercises/mazy-mice/canonican-data.json | 60 ++++++++++++++++++++----- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/exercises/mazy-mice/canonican-data.json b/exercises/mazy-mice/canonican-data.json index bf2b502032..91a850b3c8 100644 --- a/exercises/mazy-mice/canonican-data.json +++ b/exercises/mazy-mice/canonican-data.json @@ -19,10 +19,50 @@ " - two mazes with different seeds should not be equal " ], "cases": [ + { + "uuid": "e01f6db6-613c-4b55-9c09-e87edc0b04dd", + "description": "The dimensions of the maze are correct", + "property": "generateMaze", + "input": { + "rows": 6, + "cols": 18 + }, + "expected": "the generated maze has 13 lines and 37 columns" + }, + { + "uuid": "4782cea6-a1e3-48b2-b825-a805890b5118", + "description": "The maze contains only valid characters", + "property": "generateMaze", + "input": { + "rows": 6, + "cols": 18 + }, + "expected": "the generated maze has only valid characters" + }, + { + "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": "the generated maze has a single entrance on the left side" + }, + { + "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": "the generated maze has a single exit on the right side" + }, { "uuid": "1f7f50f5-4a3a-4e96-8c5e-92b284fd8b3b", "description": "the smallest square maze is perfect", - "property": "createMaze", + "property": "generateMaze", "input": { "rows": 5, "cols": 5 @@ -32,7 +72,7 @@ { "uuid": "2a8e8f63-7e89-4c9a-8d1f-1439a7d9a3e9", "description": "the small rectangular maze is perfect", - "property": "createMaze", + "property": "generateMaze", "input": { "rows": 5, "cols": 10 @@ -42,7 +82,7 @@ { "uuid": "3b6e8d5c-2a8d-4f03-9e7a-6c8f2a4e4f88", "description": "the square maze is perfect", - "property": "createMaze", + "property": "generateMaze", "input": { "rows": 10, "cols": 10 @@ -52,7 +92,7 @@ { "uuid": "4c7f6e5b-5e45-4a8d-8e8a-7f3e3e4e5f99", "description": "the large rectangular maze is perfect", - "property": "createMaze", + "property": "generateMaze", "input": { "rows": 10, "cols": 20 @@ -62,7 +102,7 @@ { "uuid": "5d8f7f6c-6e46-4a9d-8e8b-8f3f3f4e6f00", "description": "the rectangular maze with aspect 2:1 is perfect", - "property": "createMaze", + "property": "generateMaze", "input": { "rows": 20, "cols": 10 @@ -72,7 +112,7 @@ { "uuid": "6e9f8f7d-7e47-4a9e-8e8c-9f3f3f4e7f01", "description": "the huge rectangular maze is perfect", - "property": "createMaze", + "property": "generateMaze", "input": { "rows": 20, "cols": 100 @@ -82,7 +122,7 @@ { "uuid": "7fa0a0b1-8e48-4a9f-8e8d-af4f4f5e8f02", "description": "the huge square maze is perfect", - "property": "createMaze", + "property": "generateMaze", "input": { "rows": 100, "cols": 100 @@ -92,7 +132,7 @@ { "uuid": "8fb1c1d2-9e49-4aa0-8e8e-bf5f5f6e9f03", "description": "if the seed parameter is specified, the perfect maze generated", - "property": "createMaze", + "property": "generateMaze", "input": { "rows": 50, "cols": 50, @@ -103,7 +143,7 @@ { "uuid": "9fc2d2e3-af4a-4ab1-8e8f-cf6f6f7eaf04", "description": "if the seed parameter is omitted, random mazes should be generated", - "property": "createMaze", + "property": "generateMaze", "input": { "rows": 8, "cols": 16 @@ -113,7 +153,7 @@ { "uuid": "a0d3e4f4-b05b-4ac2-8e8a-df7f7f8eaf05", "description": "if the seed parameter is specified, the same maze should be generated", - "property": "createMaze", + "property": "generateMaze", "input": { "rows": 8, "cols": 16, From 45bb301d3eeb2ecbfe776bf31497f52cb975c4c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jegors=20=C4=8Cemisovs?= Date: Tue, 19 Sep 2023 13:00:50 +0300 Subject: [PATCH 8/9] Correct casing and formatting in description.md Changed the casing of a markdown hyperlink reference to maintain consistency. Also adjusted the formatting of the 'Box drawing characters' table for better legibility. These changes aim to improve the readability and adherence of the documentation to markdown standards. --- exercises/mazy-mice/description.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/exercises/mazy-mice/description.md b/exercises/mazy-mice/description.md index b96775b997..b238de2c0f 100644 --- a/exercises/mazy-mice/description.md +++ b/exercises/mazy-mice/description.md @@ -12,7 +12,7 @@ Here's what you need to know: - 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. -- Use [box-drawing][Box-drawing] characters to draw walls, and an arrow symbol (⇨) for the entrance on the left and exit on the right. +- Use [box-drawing][box-drawing] characters to draw walls, and an arrow symbol (⇨) for the entrance on the left and exit on the right. It's time to create some perfect mazes for these adventurous mice! @@ -60,18 +60,18 @@ You can use any algorithm to generate a perfect maze. The [recursive backtracker ### 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 | +| 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 | [recursive-backtracker]: https://en.wikipedia.org/wiki/Maze_generation_algorithm -[Box-drawing]: https://en.wikipedia.org/wiki/Box-drawing_character +[box-drawing]: https://en.wikipedia.org/wiki/Box-drawing_character From 5cab22d3a8490e8353713f34942038d16cb89b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jegors=20=C4=8Cemisovs?= Date: Tue, 19 Sep 2023 14:41:03 +0300 Subject: [PATCH 9/9] Update expected results format in canonical-data.json In the 'exercises/mazy-mice/canonical-data.json' file, the results format for each test case has been updated. Instead of providing an expected result as a string, a boolean or an object structure is used. The change is performed to improve the test result validation process. Boolean values help to clearly identify the pass/fail status, while the object returns the expected maze dimensions, allowing for more detailed automated test result evaluations. --- exercises/mazy-mice/canonican-data.json | 31 ++++++++++++++----------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/exercises/mazy-mice/canonican-data.json b/exercises/mazy-mice/canonican-data.json index 91a850b3c8..7e86e63e37 100644 --- a/exercises/mazy-mice/canonican-data.json +++ b/exercises/mazy-mice/canonican-data.json @@ -27,7 +27,10 @@ "rows": 6, "cols": 18 }, - "expected": "the generated maze has 13 lines and 37 columns" + "expected": { + "width": 37, + "height": 13 + } }, { "uuid": "4782cea6-a1e3-48b2-b825-a805890b5118", @@ -37,7 +40,7 @@ "rows": 6, "cols": 18 }, - "expected": "the generated maze has only valid characters" + "expected": true }, { "uuid": "1433a6ff-d18e-4ade-b37c-40b286218f07", @@ -47,7 +50,7 @@ "rows": 6, "cols": 18 }, - "expected": "the generated maze has a single entrance on the left side" + "expected": true }, { "uuid": "a0be2a1c-4ec1-412a-8a30-36d6b1d96df2", @@ -57,7 +60,7 @@ "rows": 6, "cols": 18 }, - "expected": "the generated maze has a single exit on the right side" + "expected": true }, { "uuid": "1f7f50f5-4a3a-4e96-8c5e-92b284fd8b3b", @@ -67,7 +70,7 @@ "rows": 5, "cols": 5 }, - "expected": "The maze is perfect." + "expected": true }, { "uuid": "2a8e8f63-7e89-4c9a-8d1f-1439a7d9a3e9", @@ -77,7 +80,7 @@ "rows": 5, "cols": 10 }, - "expected": "The maze is perfect." + "expected": true }, { "uuid": "3b6e8d5c-2a8d-4f03-9e7a-6c8f2a4e4f88", @@ -87,7 +90,7 @@ "rows": 10, "cols": 10 }, - "expected": "The maze is perfect." + "expected": true }, { "uuid": "4c7f6e5b-5e45-4a8d-8e8a-7f3e3e4e5f99", @@ -97,7 +100,7 @@ "rows": 10, "cols": 20 }, - "expected": "The maze is perfect." + "expected": true }, { "uuid": "5d8f7f6c-6e46-4a9d-8e8b-8f3f3f4e6f00", @@ -107,7 +110,7 @@ "rows": 20, "cols": 10 }, - "expected": "The maze is perfect." + "expected": true }, { "uuid": "6e9f8f7d-7e47-4a9e-8e8c-9f3f3f4e7f01", @@ -117,7 +120,7 @@ "rows": 20, "cols": 100 }, - "expected": "The maze is perfect." + "expected": true }, { "uuid": "7fa0a0b1-8e48-4a9f-8e8d-af4f4f5e8f02", @@ -127,7 +130,7 @@ "rows": 100, "cols": 100 }, - "expected": "The maze is perfect." + "expected": true }, { "uuid": "8fb1c1d2-9e49-4aa0-8e8e-bf5f5f6e9f03", @@ -138,7 +141,7 @@ "cols": 50, "seed": 2342342 }, - "expected": "The maze is perfect." + "expected": true }, { "uuid": "9fc2d2e3-af4a-4ab1-8e8f-cf6f6f7eaf04", @@ -148,7 +151,7 @@ "rows": 8, "cols": 16 }, - "expected": "The random maze is generated." + "expected": true }, { "uuid": "a0d3e4f4-b05b-4ac2-8e8a-df7f7f8eaf05", @@ -159,7 +162,7 @@ "cols": 16, "seed": 123 }, - "expected": "The same maze is generated." + "expected": true } ] }