Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add affine-cipher exercise #709

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JohnMertz
Copy link
Contributor

@JohnMertz JohnMertz commented Feb 6, 2025

Copy link

github-actions bot commented Feb 6, 2025

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Feb 6, 2025
@JohnMertz
Copy link
Contributor Author

Note that there are 2 trailing commas in the config.json which trips the linter. I removed them from my branch, but don't want to open a new PR.

@kotp
Copy link
Member

kotp commented Feb 6, 2025

Note that there are 2 trailing commas in the config.json which trips the linter. I removed them from my branch, but don't want to open a new PR.

No need to create a new PR at this time. You can even do a git push -f origin affine-cipher if it fits in this patch, and was a mistake (I have not looked at the code specifically yet).

@kotp kotp reopened this Feb 6, 2025
Copy link
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

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

This looks good to me, but I would make the changes to the return name in encode and decode.

I think return $ret could be correct, but it is correct for every case of returning a return, and so it is less than informative. Most other exercises use returns that are named descriptive names for their return, and according to the problem being solved.

I would like to continue that tradition for the example code.

$ret .= chr( ( ( $a * ( ord( lc($_) ) - 97 ) + $b ) % 26 ) + 97 );
}
}
return $ret;
Copy link
Member

Choose a reason for hiding this comment

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

In both cases of encode and decode the return appears to b the message (regardless of the type of message).

I would not use return $ret as it does not describe "message" as the return, in either case.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants