-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Exercise: Mazy Mice #211
Exercise: Mazy Mice #211
Conversation
This commit introduces a new algorithm for maze generation in the "maze-generator.awk" file. The code includes essential settings such as rows, columns, and seed initialization. It leverages a recursive backtracking algorithm to create the maze and arranges entry and exit doors. This change was necessary to provide a reliable and customizable maze generation process.
Introduced new tests for the maze-generator, aiming to validate the correctness of the generated mazes. Tests involve a wide range of maze dimensions and scenarios including square, rectangle dimensions, and randomness. The seed parameter's effect on maze generation process is also evaluated. The addition of these tests will help ensure the algorithm performs as expected across different use cases.
In this commit, we have added new tests for the maze-generator module. These tests are aimed at validating the correctness of the generated mazes under different conditions. They involve a wide array of scenarios including different maze dimensions and shapes (square, rectangular), as well as desired levels of randomness. In addition, the tests also evaluate how the seed parameter affects the maze generation process in order to guarantee reproducibility. The addition of these tests will help in ensuring that the algorithm performs as expected across different use cases.
Changed calling of maze-generator.awk to mazy-mice.awk in mazy-mice tests. This is to reflect the renaming of maze-generator.awk to mazy-mice.awk to make names consistent. Also uncommented skip functionality in the tests to ensure they are run during testing process. This highlights that the script being tested matches the name of the test file, increasing code readability and maintainability.
Thanks! :) FYI, @glennj will probably want to review this, and he's away on holiday for the next two weeks. (Also cc @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 can't comment on the AWK code, but I've left some general comments.
You'll also want to address the configlet lint error: https://github.com/exercism/awk/actions/runs/5849278159/job/15857441904?pr=211
https://exercism.org/docs/building/tracks/practice-exercises can be helpful |
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.
This is an impressive achievement. I imagine at some point it will be adopted into problem-specifications for other tracks to implement. After merging we'll track its success rate in https://exercism.org/tracks/awk/build
Specific changes needed:
- add the exercise to the track
config.json
, at the end of the .exercises.practice array.- This is a "hard" exercise, please use difficulty 8
- generate a UUID with
./bin/configlet uuid
- Please create a
.docs/hints.md
file containing perhaps links to articles on how to implement the algorithm.- I would have a hard time implementing this.
- this
hints.md
file creates aHINTS.md
file for CLI users: the variable-length-quantity exercise has one. I'm not sure where it shows up in the web editor.
- every exercise needs
bats-extra.bash
-- copy it from another exercise. - do we want to expose the awk maze tester to the web editor?
- Students might want to understand the
validate_maze
function in the bats test suite - If yes, then in
.meta/config.json
add"editor": ["test-maze.awk"]
to the .files object.
- Students might want to understand the
- before submitting again, run
./bin/configlet lint
and./bin/configlet fmt -e mazy-mice
Removed the backstory from the `instructions.md` of mazy-mice exercise. The backstory was not providing any useful context for solving the exercise, thus simplifying it and keeping the focus solely on the exercise details and instructions.
Included concatenated source codes of bats-support and bats-assert in a new file `bats-extra.bash` within mazy-mice exercise. These libraries provide useful helper functions for writing tests, increasing the efficiency of test scripting. The original git repositories (bats-core/bats-support and bats-core/bats-assert) were included as comments to provide reference.
Added 'editor' section in 'config.json' for 'mazy-mice' exercise. The new file 'test-maze.awk' is included in this section to improve the efficiency of test scripting, providing users with better tools for practice. This addition enhances both the utility and robustness of the exercise environment.
A new exercise 'mazy-mice' has been added to the 'config.json' file. This was done to provide more variety and challenge to users. The attributes "slug", "name", "uuid", "practices", "prerequisites" and "difficulty" have been defined for this exercise.
A new hints.md file has been added in the 'mazy-mice' exercise folder. This document provides general advice and specific suggestions on generating mazes, including possible functions to use and a recommended maze generation algorithm. This should aid students in understanding and solving this practice problem.
|
Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
Thank you for the link. I need some time to learn it :) |
Updated the hints.md in the 'mazy-mice' exercise, adding a section that provides specific Box drawing characters with their Unicode. The added detail is to help learners navigate through characters used in this exercise.
Modified maze size notations in instructions.md of the 'mazy-mice' exercise to clarify what the numbers mean. Previously, it could be interpreted as either the number of cells or characters. This change is intended to prevent confusion for learners by specifying it as the number of cells.
Changed the maze dimension instructions in 'mazy-mice' exercise to be more concise and clear. This aims to alleviate any misunderstanding around the size notation, by specifying the 'x' and 'y' dimensions as referring to the number of cells, not characters, in the maze.
Modified the description of the maze structure in the Mazy Mice exercise instructions to clarify that the dimensions refer to cells not characters. This was done to ensure that the dimensions are interpreted correctly and to prevent possible miscommunication.
Updated instructions for generating mazes in Mazy Mice exercise. The previous description was vague about the nature of the maze's layout, potentially leading to incorrect maze creation. The instructions now clearly state the maze should have a rectangular shape with opening at the start and end, providing a better guide for creating mazes.
@IsaacG did you want another look at this? |
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.
Looks good! Thanks for doing this. I have some minor word-smithing suggestions.
Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
fixed |
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.
A couple of comments. No changes strictly required.
Changed the description for generating mazes in the training material. The previous instructions ambiguously portrayed the maze's layout, which could lead to inaccurate maze creation. The new instructions specify that the maze should be in a small square format of 5x5 cells, outlining the maze's structure more accurately and effectively.
Inserted a one-second sleep delay in the mazy-mice BATS tests to ensure unique seeds for random maze generation when the seed parameter is omitted or specified. This prevents both unintentional similarities between random mazes and conflicts with the system's default seed.
Many thanks for persevering @rabestro! |
* Implement maze generation algorithm This commit introduces a new algorithm for maze generation in the "maze-generator.awk" file. The code includes essential settings such as rows, columns, and seed initialization. It leverages a recursive backtracking algorithm to create the maze and arranges entry and exit doors. This change was necessary to provide a reliable and customizable maze generation process. * Add unit tests for maze generator Introduced new tests for the maze-generator, aiming to validate the correctness of the generated mazes. Tests involve a wide range of maze dimensions and scenarios including square, rectangle dimensions, and randomness. The seed parameter's effect on maze generation process is also evaluated. The addition of these tests will help ensure the algorithm performs as expected across different use cases. * Add unit tests for maze generator In this commit, we have added new tests for the maze-generator module. These tests are aimed at validating the correctness of the generated mazes under different conditions. They involve a wide array of scenarios including different maze dimensions and shapes (square, rectangular), as well as desired levels of randomness. In addition, the tests also evaluate how the seed parameter affects the maze generation process in order to guarantee reproducibility. The addition of these tests will help in ensuring that the algorithm performs as expected across different use cases. * Replace maze-generator.awk with mazy-mice.awk in tests Changed calling of maze-generator.awk to mazy-mice.awk in mazy-mice tests. This is to reflect the renaming of maze-generator.awk to mazy-mice.awk to make names consistent. Also uncommented skip functionality in the tests to ensure they are run during testing process. This highlights that the script being tested matches the name of the test file, increasing code readability and maintainability. * Update mazy-mice exercise documentation Removed the backstory from the `instructions.md` of mazy-mice exercise. The backstory was not providing any useful context for solving the exercise, thus simplifying it and keeping the focus solely on the exercise details and instructions. * Add bats-support and bats-assert source code Included concatenated source codes of bats-support and bats-assert in a new file `bats-extra.bash` within mazy-mice exercise. These libraries provide useful helper functions for writing tests, increasing the efficiency of test scripting. The original git repositories (bats-core/bats-support and bats-core/bats-assert) were included as comments to provide reference. * Update 'config.json' for mazy-mice exercise Added 'editor' section in 'config.json' for 'mazy-mice' exercise. The new file 'test-maze.awk' is included in this section to improve the efficiency of test scripting, providing users with better tools for practice. This addition enhances both the utility and robustness of the exercise environment. * Add new exercise 'mazy-mice' to config.json A new exercise 'mazy-mice' has been added to the 'config.json' file. This was done to provide more variety and challenge to users. The attributes "slug", "name", "uuid", "practices", "prerequisites" and "difficulty" have been defined for this exercise. * Add hints documentation for 'mazy-mice' A new hints.md file has been added in the 'mazy-mice' exercise folder. This document provides general advice and specific suggestions on generating mazes, including possible functions to use and a recommended maze generation algorithm. This should aid students in understanding and solving this practice problem. * Update exercises/practice/mazy-mice/.docs/introduction.md Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com> * Update exercises/practice/mazy-mice/.meta/config.json Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com> * Update exercises/practice/mazy-mice/.docs/instructions.md Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com> * Add box drawing characters to 'mazy-mice' hints Updated the hints.md in the 'mazy-mice' exercise, adding a section that provides specific Box drawing characters with their Unicode. The added detail is to help learners navigate through characters used in this exercise. * Update maze size notation in instructions.md Modified maze size notations in instructions.md of the 'mazy-mice' exercise to clarify what the numbers mean. Previously, it could be interpreted as either the number of cells or characters. This change is intended to prevent confusion for learners by specifying it as the number of cells. * Refine maze dimension instructions in mazy-mice exercise Changed the maze dimension instructions in 'mazy-mice' exercise to be more concise and clear. This aims to alleviate any misunderstanding around the size notation, by specifying the 'x' and 'y' dimensions as referring to the number of cells, not characters, in the maze. * Update Mazy Mice exercise description for clarity Modified the description of the maze structure in the Mazy Mice exercise instructions to clarify that the dimensions refer to cells not characters. This was done to ensure that the dimensions are interpreted correctly and to prevent possible miscommunication. * Revise maze details in Mazy Mice instructions Updated instructions for generating mazes in Mazy Mice exercise. The previous description was vague about the nature of the maze's layout, potentially leading to incorrect maze creation. The instructions now clearly state the maze should have a rectangular shape with opening at the start and end, providing a better guide for creating mazes. * Update exercises/practice/mazy-mice/.docs/instructions.md Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com> * Update exercises/practice/mazy-mice/.docs/instructions.md Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com> * Update exercises/practice/mazy-mice/.docs/instructions.md Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com> * Update maze description in tutorial Changed the description for generating mazes in the training material. The previous instructions ambiguously portrayed the maze's layout, which could lead to inaccurate maze creation. The new instructions specify that the maze should be in a small square format of 5x5 cells, outlining the maze's structure more accurately and effectively. * Add sleep to ensure unique seed in mazy-mice test Inserted a one-second sleep delay in the mazy-mice BATS tests to ensure unique seeds for random maze generation when the seed parameter is omitted or specified. This prevents both unintentional similarities between random mazes and conflicts with the system's default seed. --------- Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
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
Hints
General
rand
numeric function can generate random numbers.srand
numeric function will be helpful to set the seed forrand
.Maze generation
You can use any algorithm to generate a perfect maze. The recursive backtracker is a good choice.
Box drawing characters