feat: Introduce hamming code generator
Introduced a new .py file which generates 16 bit hamming codes from the given 11 bit input. Additional 5 bits are redundant, used to correct single bit errors within the data bits
Describe your change:
Introduced a new .py file called hamming_code_generator.py which generates 16 bit hamming codes. 5 bits introduced are for redundancy and used to check and correct for a single bit change anywhere in the final 16 bit binary number. Doctests are written and all other rules mentioned in the checklist and README.md file are followed by me.
- [x] Add an algorithm?
- [ ] Fix a bug or typo in an existing algorithm?
- [ ] Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
- [ ] Documentation change?
Checklist:
- [x] I have read CONTRIBUTING.md.
- [x] This pull request is all my own work -- I have not plagiarized.
- [x] I know that pull requests will not be merged if they fail the automated tests.
- [x] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
- [x] All new Python files are placed inside an existing directory.
- [x] All filenames are in all lowercase characters with no spaces or dashes.
- [x] All functions and variable names follow Python naming conventions.
- [x] All function parameters and return values are annotated with Python type hints.
- [x] All functions have doctests that pass the automated testing.
- [x] All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
- [x] 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".
will change the names of x, y to temp_bit1, temp_bit2
made the lines in the docstring shorter, imported modules according to the specified norm and added k values to a list and used membership operation instead of checking the values of k individually in one of the if statements
@jeffreyyancey added the appropriate changes
The only concern I have left is that it doesn't appear your are enforcing that the number that comes in contains only "0" or "1" characters. It appears to just be converting any character that isn't a "0" to 1. So a string like "#&! & ((30qhjj1+" would be accepted and become 1111111110111111.
The only concern I have left is that it doesn't appear your are enforcing that the
numberthat comes in contains only "0" or "1" characters. It appears to just be converting any character that isn't a "0" to 1. So a string like "#&! & ((30qhjj1+" would be accepted and become 1111111110111111.
Oh yes, I completely overlooked this, thanks I'll make the changes.
Updated the code, can you, if possible merge the PR now?
@jeffreyyancey implemented the pop method
@jeffreyyancey this is actually my first open source contribution, so do you have any idea how the PR can be accepeted into the main repo?
I believe that one of the admins needs to give their approval. Approvals from other users will not allow merging. Instead, it helps find any issues prior to one of the individuals with the rights to approve for merging to view.
Ok got it, thanks for the help