Skip to content

Commit acc8444

Browse files
authored
Sync files (#453)
* Sync docs and metadata * Sync pig-latin tests
1 parent aaae064 commit acc8444

File tree

13 files changed

+107
-66
lines changed

13 files changed

+107
-66
lines changed

exercises/practice/affine-cipher/.docs/instructions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Create an implementation of the affine cipher, an ancient encryption system crea
44

55
The affine cipher is a type of monoalphabetic substitution cipher.
66
Each character is mapped to its numeric equivalent, encrypted with a mathematical function and then converted to the letter relating to its new numeric value.
7-
Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the atbash cipher, because it has many more keys.
7+
Although all monoalphabetic ciphers are weak, the affine cipher is much stronger than the Atbash cipher, because it has many more keys.
88

99
[//]: # " monoalphabetic as spelled by Merriam-Webster, compare to polyalphabetic "
1010

exercises/practice/atbash-cipher/.docs/instructions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Instructions
22

3-
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
3+
Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.
44

55
The Atbash cipher is a simple substitution cipher that relies on transposing all the letters in the alphabet such that the resulting alphabet is backwards.
66
The first letter is replaced with the last letter, the second with the second-last, and so on.

exercises/practice/atbash-cipher/.meta/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
".meta/example.el"
1818
]
1919
},
20-
"blurb": "Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.",
20+
"blurb": "Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.",
2121
"source": "Wikipedia",
2222
"source_url": "https://en.wikipedia.org/wiki/Atbash"
2323
}
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,3 @@
11
# Instructions
22

3-
The Collatz Conjecture or 3x+1 problem can be summarized as follows:
4-
5-
Take any positive integer n.
6-
If n is even, divide n by 2 to get n / 2.
7-
If n is odd, multiply n by 3 and add 1 to get 3n + 1.
8-
Repeat the process indefinitely.
9-
The conjecture states that no matter which number you start with, you will always reach 1 eventually.
10-
11-
Given a number n, return the number of steps required to reach 1.
12-
13-
## Examples
14-
15-
Starting with n = 12, the steps would be as follows:
16-
17-
0. 12
18-
1. 6
19-
2. 3
20-
3. 10
21-
4. 5
22-
5. 16
23-
6. 8
24-
7. 4
25-
8. 2
26-
9. 1
27-
28-
Resulting in 9 steps.
29-
So for input n = 12, the return value would be 9.
3+
Given a positive integer, return the number of steps it takes to reach 1 according to the rules of the Collatz Conjecture.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Introduction
2+
3+
One evening, you stumbled upon an old notebook filled with cryptic scribbles, as though someone had been obsessively chasing an idea.
4+
On one page, a single question stood out: **Can every number find its way to 1?**
5+
It was tied to something called the **Collatz Conjecture**, a puzzle that has baffled thinkers for decades.
6+
7+
The rules were deceptively simple.
8+
Pick any positive integer.
9+
10+
- If it's even, divide it by 2.
11+
- If it's odd, multiply it by 3 and add 1.
12+
13+
Then, repeat these steps with the result, continuing indefinitely.
14+
15+
Curious, you picked number 12 to test and began the journey:
16+
17+
12 ➜ 6 ➜ 3 ➜ 10 ➜ 5 ➜ 16 ➜ 8 ➜ 4 ➜ 2 ➜ 1
18+
19+
Counting from the second number (6), it took 9 steps to reach 1, and each time the rules repeated, the number kept changing.
20+
At first, the sequence seemed unpredictable — jumping up, down, and all over.
21+
Yet, the conjecture claims that no matter the starting number, we'll always end at 1.
22+
23+
It was fascinating, but also puzzling.
24+
Why does this always seem to work?
25+
Could there be a number where the process breaks down, looping forever or escaping into infinity?
26+
The notebook suggested solving this could reveal something profound — and with it, fame, [fortune][collatz-prize], and a place in history awaits whoever could unlock its secrets.
27+
28+
[collatz-prize]: https://mathprize.net/posts/collatz-conjecture/

exercises/practice/collatz-conjecture/.meta/config.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
]
1515
},
1616
"blurb": "Calculate the number of steps to reach 1 using the Collatz conjecture.",
17-
"source": "An unsolved problem in mathematics named after mathematician Lothar Collatz",
18-
"source_url": "https://en.wikipedia.org/wiki/3x_%2B_1_problem"
17+
"source": "Wikipedia",
18+
"source_url": "https://en.wikipedia.org/wiki/Collatz_conjecture"
1919
}

exercises/practice/eliuds-eggs/.docs/introduction.md

+33-15
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,54 @@ The position information encoding is calculated as follows:
1212
2. Convert the number from binary to decimal.
1313
3. Show the result on the display.
1414

15-
Example 1:
15+
## Example 1
16+
17+
![Seven individual nest boxes arranged in a row whose first, third, fourth and seventh nests each have a single egg.](https://assets.exercism.org/images/exercises/eliuds-eggs/example-1-coop.svg)
1618

1719
```text
18-
Chicken Coop:
1920
_ _ _ _ _ _ _
2021
|E| |E|E| | |E|
22+
```
23+
24+
### Resulting Binary
25+
26+
![1011001](https://assets.exercism.org/images/exercises/eliuds-eggs/example-1-binary.svg)
27+
28+
```text
29+
_ _ _ _ _ _ _
30+
|1|0|1|1|0|0|1|
31+
```
2132

22-
Resulting Binary:
23-
1 0 1 1 0 0 1
33+
### Decimal number on the display
2434

25-
Decimal number on the display:
2635
89
2736

28-
Actual eggs in the coop:
37+
### Actual eggs in the coop
38+
2939
4
40+
41+
## Example 2
42+
43+
![Seven individual nest boxes arranged in a row where only the fourth nest has an egg.](https://assets.exercism.org/images/exercises/eliuds-eggs/example-2-coop.svg)
44+
45+
```text
46+
_ _ _ _ _ _ _
47+
| | | |E| | | |
3048
```
3149

32-
Example 2:
50+
### Resulting Binary
51+
52+
![0001000](https://assets.exercism.org/images/exercises/eliuds-eggs/example-2-binary.svg)
3353

3454
```text
35-
Chicken Coop:
36-
_ _ _ _ _ _ _ _
37-
| | | |E| | | | |
55+
_ _ _ _ _ _ _
56+
|0|0|0|1|0|0|0|
57+
```
3858

39-
Resulting Binary:
40-
0 0 0 1 0 0 0 0
59+
### Decimal number on the display
4160

42-
Decimal number on the display:
4361
16
4462

45-
Actual eggs in the coop:
63+
### Actual eggs in the coop
64+
4665
1
47-
```
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Instructions
22

3-
Given students' names along with the grade that they are in, create a roster for the school.
3+
Given students' names along with the grade they are in, create a roster for the school.
44

55
In the end, you should be able to:
66

7-
- Add a student's name to the roster for a grade
7+
- Add a student's name to the roster for a grade:
88
- "Add Jim to grade 2."
99
- "OK."
10-
- Get a list of all students enrolled in a grade
10+
- Get a list of all students enrolled in a grade:
1111
- "Which students are in grade 2?"
12-
- "We've only got Jim just now."
12+
- "We've only got Jim right now."
1313
- Get a sorted list of all students in all grades.
14-
Grades should sort as 1, 2, 3, etc., and students within a grade should be sorted alphabetically by name.
15-
- "Who all is enrolled in school right now?"
14+
Grades should be sorted as 1, 2, 3, etc., and students within a grade should be sorted alphabetically by name.
15+
- "Who is enrolled in school right now?"
1616
- "Let me think.
17-
We have Anna, Barb, and Charlie in grade 1, Alex, Peter, and Zoe in grade 2 and Jim in grade 5.
18-
So the answer is: Anna, Barb, Charlie, Alex, Peter, Zoe and Jim"
17+
We have Anna, Barb, and Charlie in grade 1, Alex, Peter, and Zoe in grade 2, and Jim in grade 5.
18+
So the answer is: Anna, Barb, Charlie, Alex, Peter, Zoe, and Jim."
1919

20-
Note that all our students only have one name (It's a small town, what do you want?) and each student cannot be added more than once to a grade or the roster.
21-
In fact, when a test attempts to add the same student more than once, your implementation should indicate that this is incorrect.
20+
Note that all our students only have one name (it's a small town, what do you want?), and each student cannot be added more than once to a grade or the roster.
21+
If a test attempts to add the same student more than once, your implementation should indicate that this is incorrect.

exercises/practice/knapsack/.docs/instructions.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Instructions
22

3-
Your task is to determine which items to take so that the total value of his selection is maximized, taking into account the knapsack's carrying capacity.
3+
Your task is to determine which items to take so that the total value of her selection is maximized, taking into account the knapsack's carrying capacity.
44

55
Items will be represented as a list of items.
66
Each item will have a weight and value.
77
All values given will be strictly positive.
8-
Bob can take only one of each item.
8+
Lhakpa can take only one of each item.
99

1010
For example:
1111

@@ -21,5 +21,5 @@ Knapsack Maximum Weight: 10
2121
```
2222

2323
For the above, the first item has weight 5 and value 10, the second item has weight 4 and value 40, and so on.
24-
In this example, Bob should take the second and fourth item to maximize his value, which, in this case, is 90.
25-
He cannot get more than 90 as his knapsack has a weight limit of 10.
24+
In this example, Lhakpa should take the second and fourth item to maximize her value, which, in this case, is 90.
25+
She cannot get more than 90 as her knapsack has a weight limit of 10.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Introduction
22

3-
Bob is a thief.
4-
After months of careful planning, he finally manages to crack the security systems of a fancy store.
3+
Lhakpa is a [Sherpa][sherpa] mountain guide and porter.
4+
After months of careful planning, the expedition Lhakpa works for is about to leave.
5+
She will be paid the value she carried to the base camp.
56

6-
In front of him are many items, each with a value and weight.
7-
Bob would gladly take all of the items, but his knapsack can only hold so much weight.
8-
Bob has to carefully consider which items to take so that the total value of his selection is maximized.
7+
In front of her are many items, each with a value and weight.
8+
Lhakpa would gladly take all of the items, but her knapsack can only hold so much weight.
9+
10+
[sherpa]: https://en.wikipedia.org/wiki/Sherpa_people#Mountaineering
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Introduction
2+
3+
You've joined LinkLine, a leading communications company working to ensure reliable connections for everyone.
4+
The team faces a big challenge: users submit phone numbers in all sorts of formats — dashes, spaces, dots, parentheses, and even prefixes.
5+
Some numbers are valid, while others are impossible to use.
6+
7+
Your mission is to turn this chaos into order.
8+
You'll clean up valid numbers, formatting them appropriately for use in the system.
9+
At the same time, you'll identify and filter out any invalid entries.
10+
11+
The success of LinkLine's operations depends on your ability to separate the useful from the unusable.
12+
Are you ready to take on the challenge and keep the connections running smoothly?

exercises/practice/pig-latin/.meta/tests.toml

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ description = "first letter and ay are moved to the end of words that start with
3939
[bce94a7a-a94e-4e2b-80f4-b2bb02e40f71]
4040
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with q without a following u"
4141

42+
[e59dbbe8-ccee-4619-a8e9-ce017489bfc0]
43+
description = "first letter and ay are moved to the end of words that start with consonants -> word beginning with consonant and vowel containing qu"
44+
4245
[c01e049a-e3e2-451c-bf8e-e2abb7e438b8]
4346
description = "some letter clusters are treated like a single consonant -> word beginning with ch"
4447

exercises/practice/pig-latin/pig-latin-test.el

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
(should (string= (translate "qat") "atqay")))
5050

5151

52+
(ert-deftest word-beginning-with-consonant-and-vowel-containing-qu ()
53+
(should (string= (translate "liquid") "iquidlay")))
54+
55+
5256
(ert-deftest word-beginning-with-ch ()
5357
(should (string= (translate "chair") "airchay")))
5458

0 commit comments

Comments
 (0)