Skip to content

fix: make documentation and tests descriptive and concise #9289

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

Closed
wants to merge 2 commits into from

Conversation

AdePhil
Copy link
Contributor

@AdePhil AdePhil commented Oct 1, 2023

Describe your change:

Fixes #9066

  • There is some confusion about what 1 and 0 represent. The documentation states that 0 represents walls, and 1 represents valid paths, but the algorithm assumes that valid paths are represented by 0, while walls are represented by 1.
  • I have updated the tests and documentation to be more descriptive and concise, with 1 representing valid paths and 0 representing dead ends.
  • I have updated the logic to consider 1 as a valid path.
  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Oct 1, 2023
Copy link

@dlesnoff dlesnoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this Pull Request a lot, as it flips the values of the input in the test examples and adapt the algorithm, which makes the input consistent with the output.
In the end, a user wants to compare the output with the input. It is easier to find the open path in the input when both the input and the output have the same representation for open paths.

It does one thing and it does it well.
Other improvements are done in this Pull Request: https://github.com/TheAlgorithms/Python/pull/9148/files
If this Pull Request is merged first, it is important to ensure that there are not too much conflicts as to not lose progress made in other PRs.

cell in the matrix contains a value 0 or 1.
In this matrix, 1 represent a valid path that can be
followed to reach the end of the matrix,
while 0 is a dead end. The rat is allowed to move in 4 directions:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer wall/obstacle to "dead end".
According to the Cambridge Dictionary, a "dead end" is:
« a road that is closed at one end, and does not lead anywhere: »
A "dead end" is already a road and doesn't as such depict very well what I see from the input.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dlesnoff Thanks for the review. I have made the update you suggested here.

@AdePhil AdePhil closed this Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backtracking/Rat Maze
2 participants