-
-
Notifications
You must be signed in to change notification settings - Fork 554
Rework secret-handshake documentation #2219
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
085149e
Rework secret-handshake documentation
kytrinyx e19a9ae
Update exercises/secret-handshake/introduction.md
kytrinyx 04cf8be
Update exercises/secret-handshake/instructions.md
kytrinyx f71376a
Update exercises/secret-handshake/introduction.md
kytrinyx e9c95d3
Update exercises/secret-handshake/instructions.md
kytrinyx d17aa7c
Fix special block formatting
kytrinyx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Instructions | ||
|
||
Your task is to convert a number between 1 and 31 to a sequence of actions in the secret handshake. | ||
|
||
The sequence of actions is chosen by looking at the rightmost five digits of the number once it's been converted to binary. | ||
Start at the right-most digit and move left. | ||
|
||
The actions for each number place are: | ||
|
||
```plaintext | ||
00001 = wink | ||
00010 = double blink | ||
00100 = close your eyes | ||
01000 = jump | ||
10000 = Reverse the order of the operations in the secret handshake. | ||
``` | ||
|
||
Let's use the number `9` as an example: | ||
|
||
- 9 in binary is `1001`. | ||
- The digit that is farthest to the right is 1, so the first action is `wink`. | ||
- Going left, the next digit is 0, so there is no double-blink. | ||
- Going left again, the next digit is 0, so you leave your eyes open. | ||
- Going left again, the next digit is 1, so you jump. | ||
|
||
That was the last digit, so the final code is: | ||
|
||
```plaintext | ||
wink, jump | ||
``` | ||
|
||
Given the number 26, which is `11010` in binary, we get the following actions: | ||
|
||
- double blink | ||
- jump | ||
- reverse actions | ||
|
||
The secret handshake for 26 is therefore: | ||
|
||
```plaintext | ||
jump, double blink | ||
``` | ||
|
||
~~~~exercism/note | ||
If you aren't sure what binary is or how it works, check out [this binary tutorial][intro-to-binary]. | ||
[intro-to-binary]: https://medium.com/basecs/bits-bytes-building-with-binary-13cb4289aafa | ||
kytrinyx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
~~~~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Introduction | ||
|
||
You are starting a secret coding club with some friends and friends-of-friends. | ||
Not everyone knows each other, so you and your friends have decided to create a secret handshake that you can use to recognize that someone is a member. | ||
You don't want anyone who isn't in the know to be able to crack the code. | ||
|
||
You've designed the code so that one person says a number between 1 and 31, and the other person turns it into a series of actions. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.