Skip to content

Add Polybius cipher #5409

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

Merged
merged 3 commits into from
Oct 19, 2021
Merged

Add Polybius cipher #5409

merged 3 commits into from
Oct 19, 2021

Conversation

cordeirossauro
Copy link
Contributor

@cordeirossauro cordeirossauro commented Oct 18, 2021

Describe your change:

  • 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 have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

Sorry if I shouldn't have deleted my last PR, I had some problems with my forked repository and decided to try it again from scratch (still trying to learn how to use Git). I think all the errors with the tests are fixed now.

@ghost ghost added the awaiting reviews This PR is ready to be reviewed label Oct 18, 2021
@ghost ghost added the tests are failing Do not merge until tests pass label Oct 18, 2021
"44154344 32154343112215"
"""
message = message.lower()
message = message.replace("j", "i")
Copy link
Member

Choose a reason for hiding this comment

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

Why replace? Please add test for this condition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since there's only 25 spaces in the polybius square and 26 letters, the cipher replaces all j's in the message with i's
A test was added for this condition

@l3str4nge
Copy link
Member

Please also fix the build issues

@cordeirossauro
Copy link
Contributor Author

I'm having a lot of trouble getting the tests' syntax right, that's probably the reason for the build issues. This last commit tries to fix that, let's hope it works!

@ghost ghost removed the tests are failing Do not merge until tests pass label Oct 18, 2021
Copy link
Member

@l3str4nge l3str4nge left a comment

Choose a reason for hiding this comment

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

🚀

@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Oct 19, 2021
@l3str4nge l3str4nge merged commit 4880931 into TheAlgorithms:master Oct 19, 2021
shermanhui pushed a commit to shermanhui/Python that referenced this pull request Oct 22, 2021
* Add polybius cipher

* Fix polybius.py build issues and add test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants