Skip to content

Commit 798cf4a

Browse files
committed
Rework secret-handshake documentation
This PR is part of our project of making our Practice Exercises more consistent and human. For more context please see the following forum-thread: https://forum.exercism.org/t/new-project-making-practice-exercises-more-consistent-and-human-across-exercism/3943 The main changes for this exercise are: - make the introduction friendlier - move everything about binary into the instructions - make the instructions more approachable and (hopefully) easier to understand
1 parent 8732076 commit 798cf4a

File tree

3 files changed

+53
-24
lines changed

3 files changed

+53
-24
lines changed

exercises/secret-handshake/description.md

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Instructions
2+
3+
Your task is to convert a number between 1 and 31 to a sequence of actions in the secret handshake.
4+
5+
The sequence of actions are 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.
7+
8+
The actions for each number place are:
9+
10+
```plaintext
11+
00001 = wink
12+
00010 = double blink
13+
00100 = close your eyes
14+
01000 = jump
15+
10000 = Reverse the order of the operations in the secret handshake.
16+
```
17+
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.
25+
26+
That was the last digit, so the final code is:
27+
28+
```plaintext
29+
wink, jump
30+
```
31+
32+
Given the number 26, which is `11010` in binary, we get the following actions:
33+
- double blink
34+
- jump
35+
- reverse actions
36+
37+
The secret handshake for 26 is therefore:
38+
39+
```plaintext
40+
jump, double blink
41+
```
42+
43+
```exercism/note
44+
If you aren't sure what binary is or how it works, check out [this tutorial][intro-to-binary].
45+
[intro-to-binary]: https://medium.com/basecs/bits-bytes-building-with-binary-13cb4289aafa
46+
```
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 recognise 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 other person turns it into a series of actions.

0 commit comments

Comments
 (0)