Skip to content

Commit e7ad239

Browse files
kytrinyxBethanyG
authored andcommitted
Sync secret-handshake docs with problem-specifications
The secret-handshake exercise has been overhauled as part of a project to make practice exercises more consistent and friendly. For more context, please see the discussion in the forum, as well as the pull request that updated the exercise in the problem-specifications repository: - https://forum.exercism.org/t/new-project-making-practice-exercises-more-consistent-and-human-across-exercism/3943 - exercism/problem-specifications#2219
1 parent 4eb84a2 commit e7ad239

File tree

2 files changed

+40
-10
lines changed

2 files changed

+40
-10
lines changed
Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,47 @@
11
# Instructions
22

3-
> There are 10 types of people in the world: Those who understand
4-
> binary, and those who don't.
3+
Your task is to convert a number between 1 and 31 to a sequence of actions in the secret handshake.
54

6-
You and your fellow cohort of those in the "know" when it comes to binary decide to come up with a secret "handshake".
5+
The sequence of actions is chosen by looking at the rightmost five digits of the number once it's been converted to binary.
6+
Start at the right-most digit and move left.
77

8-
```text
8+
The actions for each number place are:
9+
10+
```plaintext
911
00001 = wink
1012
00010 = double blink
1113
00100 = close your eyes
1214
01000 = jump
13-
1415
10000 = Reverse the order of the operations in the secret handshake.
1516
```
1617

17-
Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
18+
Let's use the number `9` as an example:
19+
20+
- 9 in binary is `1001`.
21+
- The digit that is farthest to the right is 1, so the first action is `wink`.
22+
- Going left, the next digit is 0, so there is no double-blink.
23+
- Going left again, the next digit is 0, so you leave your eyes open.
24+
- Going left again, the next digit is 1, so you jump.
1825

19-
Here's a couple of examples:
26+
That was the last digit, so the final code is:
27+
28+
```plaintext
29+
wink, jump
30+
```
2031

21-
Given the decimal input 3, the function would return the array ["wink", "double blink"] because the decimal number 3 is 2+1 in powers of two and thus `11` in binary.
32+
Given the number 26, which is `11010` in binary, we get the following actions:
33+
34+
- double blink
35+
- jump
36+
- reverse actions
37+
38+
The secret handshake for 26 is therefore:
39+
40+
```plaintext
41+
jump, double blink
42+
```
2243

23-
Let's now examine the input 19 which is 16+2+1 in powers of two and thus `10011` in binary.
24-
Recalling that the addition of 16 (`10000` in binary) reverses an array and that we already know what array is returned given input 3, the array returned for input 19 is ["double blink", "wink"].
44+
~~~~exercism/note
45+
If you aren't sure what binary is or how it works, check out [this binary tutorial][intro-to-binary].
46+
[intro-to-binary]: https://medium.com/basecs/bits-bytes-building-with-binary-13cb4289aafa
47+
~~~~
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Introduction
2+
3+
You are starting a secret coding club with some friends and friends-of-friends.
4+
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.
5+
You don't want anyone who isn't in the know to be able to crack the code.
6+
7+
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.

0 commit comments

Comments
 (0)