Skip to content

Commit aaae064

Browse files
authored
Sync files, metadata, and tests (exercism#451)
* Sync files, metadata, and tests * Update expected value
1 parent a055f3d commit aaae064

File tree

10 files changed

+65
-25
lines changed

10 files changed

+65
-25
lines changed

exercises/practice/bob/.meta/tests.toml

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ description = "alternate silence"
7171

7272
[66953780-165b-4e7e-8ce3-4bcb80b6385a]
7373
description = "multiple line question"
74+
include = false
7475

7576
[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
7677
description = "starting with whitespace"
@@ -83,3 +84,7 @@ description = "other whitespace"
8384

8485
[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
8586
description = "non-question ending with whitespace"
87+
88+
[2c7278ac-f955-4eb4-bf8f-e33eb4116a15]
89+
description = "multiple line question"
90+
reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a"

exercises/practice/bob/bob-test.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989

9090
(ert-deftest responds-to-multiple-line-question ()
9191
(should
92-
(string= "Whatever." (response-for "\nDoes this cryogenic chamber make me look fat?\nno"))))
92+
(string= "Sure." (response-for "\nDoes this cryogenic chamber make\n me look fat?"))))
9393

9494
(ert-deftest responds-to-starting-with-whitespace ()
9595
(should

exercises/practice/hamming/.docs/instructions.md

-11
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
Calculate the Hamming distance between two DNA strands.
44

5-
Your body is made up of cells that contain DNA.
6-
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
7-
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
8-
9-
When cells divide, their DNA replicates too.
10-
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
11-
If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred.
12-
This is known as the "Hamming distance".
13-
145
We read DNA using the letters C, A, G and T.
156
Two strands might look like this:
167

@@ -20,8 +11,6 @@ Two strands might look like this:
2011

2112
They have 7 differences, and therefore the Hamming distance is 7.
2213

23-
The Hamming distance is useful for lots of things in science, not just biology, so it's a nice phrase to be familiar with :)
24-
2514
## Implementation notes
2615

2716
The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should not work.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Introduction
2+
3+
Your body is made up of cells that contain DNA.
4+
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
5+
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
6+
7+
When cells divide, their DNA replicates too.
8+
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
9+
If we compare two strands of DNA and count the differences between them, we can see how many mistakes occurred.
10+
This is known as the "Hamming distance".
11+
12+
The Hamming distance is useful in many areas of science, not just biology, so it's a nice phrase to be familiar with :)

exercises/practice/protein-translation/.docs/instructions.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
Translate RNA sequences into proteins.
44

5-
RNA can be broken into three nucleotide sequences called codons, and then translated to a polypeptide like so:
5+
RNA can be broken into three-nucleotide sequences called codons, and then translated to a protein like so:
66

77
RNA: `"AUGUUUUCU"` => translates to
88

99
Codons: `"AUG", "UUU", "UCU"`
10-
=> which become a polypeptide with the following sequence =>
10+
=> which become a protein with the following sequence =>
1111

1212
Protein: `"Methionine", "Phenylalanine", "Serine"`
1313

@@ -27,9 +27,9 @@ Protein: `"Methionine", "Phenylalanine", "Serine"`
2727

2828
Note the stop codon `"UAA"` terminates the translation and the final methionine is not translated into the protein sequence.
2929

30-
Below are the codons and resulting Amino Acids needed for the exercise.
30+
Below are the codons and resulting amino acids needed for the exercise.
3131

32-
| Codon | Protein |
32+
| Codon | Amino Acid |
3333
| :----------------- | :------------ |
3434
| AUG | Methionine |
3535
| UUU, UUC | Phenylalanine |

exercises/practice/pythagorean-triplet/.docs/instructions.md

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

33
A Pythagorean triplet is a set of three natural numbers, {a, b, c}, for which,
44

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Introduction
2+
3+
You are an accomplished problem-solver, known for your ability to tackle the most challenging mathematical puzzles.
4+
One evening, you receive an urgent letter from an inventor called the Triangle Tinkerer, who is working on a groundbreaking new project.
5+
The letter reads:
6+
7+
> Dear Mathematician,
8+
>
9+
> I need your help.
10+
> I am designing a device that relies on the unique properties of Pythagorean triplets — sets of three integers that satisfy the equation a² + b² = c².
11+
> This device will revolutionize navigation, but for it to work, I must program it with every possible triplet where the sum of a, b, and c equals a specific number, N.
12+
> Calculating these triplets by hand would take me years, but I hear you are more than up to the task.
13+
>
14+
> Time is of the essence.
15+
> The future of my invention — and perhaps even the future of mathematical innovation — rests on your ability to solve this problem.
16+
17+
Motivated by the importance of the task, you set out to find all Pythagorean triplets that satisfy the condition.
18+
Your work could have far-reaching implications, unlocking new possibilities in science and engineering.
19+
Can you rise to the challenge and make history?

exercises/practice/pythagorean-triplet/.meta/config.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
".meta/example.el"
1414
]
1515
},
16-
"blurb": "There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the triplet.",
17-
"source": "Problem 9 at Project Euler",
16+
"blurb": "Given an integer N, find all Pythagorean triplets for which a + b + c = N.",
17+
"source": "A variation of Problem 9 from Project Euler",
1818
"source_url": "https://projecteuler.net/problem=9"
1919
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# Instructions
22

3-
Given a natural radicand, return its square root.
3+
Your task is to calculate the square root of a given number.
44

5-
Note that the term "radicand" refers to the number for which the root is to be determined.
6-
That is, it is the number under the root symbol.
5+
- Try to avoid using the pre-existing math libraries of your language.
6+
- As input you'll be given a positive whole number, i.e. 1, 2, 3, 4…
7+
- You are only required to handle cases where the result is a positive whole number.
78

8-
Check out the Wikipedia pages on [square root][square-root] and [methods of computing square roots][computing-square-roots].
9+
Some potential approaches:
910

10-
Recall also that natural numbers are positive real whole numbers (i.e. 1, 2, 3 and up).
11+
- Linear or binary search for a number that gives the input number when squared.
12+
- Successive approximation using Newton's or Heron's method.
13+
- Calculating one digit at a time or one bit at a time.
1114

12-
[square-root]: https://en.wikipedia.org/wiki/Square_root
15+
You can check out the Wikipedia pages on [integer square root][integer-square-root] and [methods of computing square roots][computing-square-roots] to help with choosing a method of calculation.
16+
17+
[integer-square-root]: https://en.wikipedia.org/wiki/Integer_square_root
1318
[computing-square-roots]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Introduction
2+
3+
We are launching a deep space exploration rocket and we need a way to make sure the navigation system stays on target.
4+
5+
As the first step in our calculation, we take a target number and find its square root (that is, the number that when multiplied by itself equals the target number).
6+
7+
The journey will be very long.
8+
To make the batteries last as long as possible, we had to make our rocket's onboard computer very power efficient.
9+
Unfortunately that means that we can't rely on fancy math libraries and functions, as they use more power.
10+
Instead we want to implement our own square root calculation.

0 commit comments

Comments
 (0)