Skip to content
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

Ruby: Project: Caesar Cipher: Fix Ruby Caesar Cipher code example #29107

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

JeffreyMPrice
Copy link
Contributor

@JeffreyMPrice JeffreyMPrice commented Nov 21, 2024

Because

There is an internal inconsistency on whether a caesar cipher should use a left shift or right shift. In the entry from Wikipedia the text and example used a left shift, while in the ruby code a right shift is used.

  > caesar_cipher("What a string!", 5)
  => "Bmfy f xywnsl!"

This PR

Update the project instructions to explicitly call for a right shift and note that the Wikipedia quote uses a left shift.

Issue

Closes #29106

Additional Information

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

A left shift of 5 for the string "What a string" should yield the value "Rcvo v nomdib!". The output in the example shows a right shift of 5.

At the very least, the example from Wikipedia shows a left shift of three, "D->A" and "E->B" while the code example shows a right shift. The examples should be consistent on the page.
@github-actions github-actions bot added the Content: Ruby Involves the Ruby course label Nov 21, 2024
@JoshDevHub JoshDevHub self-requested a review November 21, 2024 17:49
Copy link
Contributor

@JoshDevHub JoshDevHub left a comment

Choose a reason for hiding this comment

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

@JeffreyMPrice Hello and thanks for making a PR to our curriculum.

In the future, please wait to be assigned an issue by a maintainer before beginning work on it. This allows us to discuss the problem, and it helps prevent situations where multiple people work on the same issue.

For this PR, I think the change you've made here is actually more confusing. The CS50 video uses a right shift, and every solution submitted by learners is also going to use a right shift.

I would accept a little note after the Wikipedia quote to specify that the project should use a right shift, but I think requiring the project to use a left shift isn't a good idea.

* Add to project instructions using a right shift
* Add to quick tips that Wikipedia shows a left shift
* Fix lower case ceaser
@JeffreyMPrice
Copy link
Contributor Author

Thanks @JoshDevHub ! I'll wait for the assignment next time.

I've reverted the change in output and updated the instructions to explicitly call for a right shift. I added to the quick tips that Wikipedia shows a left shift. Also threw in fixing a lower case Caesar.

You are right about all the submitted solutions! I didn't think about that.

Copy link
Contributor

@JoshDevHub JoshDevHub left a comment

Choose a reason for hiding this comment

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

Nice changes! Thank you for contributing.

@JoshDevHub JoshDevHub merged commit 209f84b into TheOdinProject:main Nov 25, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: Ruby Involves the Ruby course
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ruby: Caesar Cipher ruby output shows a right shift, not left shift
2 participants