Skip to content

Commit e72019b

Browse files
Sync exercise instructions (#519)
- alphametics - darts - hello-world - pascals-triangle - perfect-numbers - pig-latin - pythagorean-triplet - raindrops - strain - two-bucket - yacht
1 parent 9d54fb7 commit e72019b

File tree

14 files changed

+89
-32
lines changed

14 files changed

+89
-32
lines changed

exercises/practice/alphametics/.docs/instructions.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Instructions
22

3-
Write a function to solve alphametics puzzles.
3+
Given an alphametics puzzle, find the correct solution.
44

55
[Alphametics][alphametics] is a puzzle where letters in words are replaced with numbers.
66

@@ -26,6 +26,4 @@ This is correct because every letter is replaced by a different number and the w
2626

2727
Each letter must represent a different digit, and the leading digit of a multi-digit number must not be zero.
2828

29-
Write a function to solve alphametics puzzles.
30-
3129
[alphametics]: https://en.wikipedia.org/wiki/Alphametics

exercises/practice/alphametics/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
".meta/example.lua"
1717
]
1818
},
19-
"blurb": "Write a function to solve alphametics puzzles."
19+
"blurb": "Given an alphametics puzzle, find the correct solution."
2020
}

exercises/practice/darts/.docs/instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Instructions
22

3-
Write a function that returns the earned points in a single toss of a Darts game.
3+
Calculate the points scored in a single toss of a Darts game.
44

55
[Darts][darts] is a game where players throw darts at a [target][darts-target].
66

@@ -16,7 +16,7 @@ In our particular instance of the game, the target rewards 4 different amounts o
1616
The outer circle has a radius of 10 units (this is equivalent to the total radius for the entire target), the middle circle a radius of 5 units, and the inner circle a radius of 1.
1717
Of course, they are all centered at the same point — that is, the circles are [concentric][] defined by the coordinates (0, 0).
1818

19-
Write a function that given a point in the target (defined by its [Cartesian coordinates][cartesian-coordinates] `x` and `y`, where `x` and `y` are [real][real-numbers]), returns the correct amount earned by a dart landing at that point.
19+
Given a point in the target (defined by its [Cartesian coordinates][cartesian-coordinates] `x` and `y`, where `x` and `y` are [real][real-numbers]), calculate the correct score earned by a dart landing at that point.
2020

2121
## Credit
2222

exercises/practice/darts/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
".meta/example.lua"
1414
]
1515
},
16-
"blurb": "Write a function that returns the earned points in a single toss of a Darts game.",
16+
"blurb": "Calculate the points scored in a single toss of a Darts game.",
1717
"source": "Inspired by an exercise created by a professor Della Paolera in Argentina"
1818
}

exercises/practice/hello-world/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
".meta/example.lua"
1919
]
2020
},
21-
"blurb": "The classical introductory exercise. Just say \"Hello, World!\".",
21+
"blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".",
2222
"source": "This is an exercise to introduce users to using Exercism",
2323
"source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
2424
}
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
11
# Instructions
22

3-
Compute Pascal's triangle up to a given number of rows.
3+
Your task is to output the first N rows of Pascal's triangle.
44

5-
In Pascal's Triangle each number is computed by adding the numbers to the right and left of the current position in the previous row.
5+
[Pascal's triangle][wikipedia] is a triangular array of positive integers.
6+
7+
In Pascal's triangle, the number of values in a row is equal to its row number (which starts at one).
8+
Therefore, the first row has one value, the second row has two values, and so on.
9+
10+
The first (topmost) row has a single value: `1`.
11+
Subsequent rows' values are computed by adding the numbers directly to the right and left of the current position in the previous row.
12+
13+
If the previous row does _not_ have a value to the left or right of the current position (which only happens for the leftmost and rightmost positions), treat that position's value as zero (effectively "ignoring" it in the summation).
14+
15+
## Example
16+
17+
Let's look at the first 5 rows of Pascal's Triangle:
618

719
```text
820
1
921
1 1
1022
1 2 1
1123
1 3 3 1
1224
1 4 6 4 1
13-
# ... etc
1425
```
26+
27+
The topmost row has one value, which is `1`.
28+
29+
The leftmost and rightmost values have only one preceding position to consider, which is the position to its right respectively to its left.
30+
With the topmost value being `1`, it follows from this that all the leftmost and rightmost values are also `1`.
31+
32+
The other values all have two positions to consider.
33+
For example, the fifth row's (`1 4 6 4 1`) middle value is `6`, as the values to its left and right in the preceding row are `3` and `3`:
34+
35+
[wikipedia]: https://en.wikipedia.org/wiki/Pascal%27s_triangle
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Introduction
2+
3+
With the weather being great, you're not looking forward to spending an hour in a classroom.
4+
Annoyed, you enter the class room, where you notice a strangely satisfying triangle shape on the blackboard.
5+
Whilst waiting for your math teacher to arrive, you can't help but notice some patterns in the triangle: the outer values are all ones, each subsequent row has one more value than its previous row and the triangle is symmetrical.
6+
Weird!
7+
8+
Not long after you sit down, your teacher enters the room and explains that this triangle is the famous [Pascal's triangle][wikipedia].
9+
10+
Over the next hour, your teacher reveals some amazing things hidden in this triangle:
11+
12+
- It can be used to compute how many ways you can pick K elements from N values.
13+
- It contains the Fibonacci sequence.
14+
- If you color odd and even numbers differently, you get a beautiful pattern called the [Sierpiński triangle][wikipedia-sierpinski-triangle].
15+
16+
The teacher implores you and your classmates to lookup other uses, and assures you that there are lots more!
17+
At that moment, the school bell rings.
18+
You realize that for the past hour, you were completely absorbed in learning about Pascal's triangle.
19+
You quickly grab your laptop from your bag and go outside, ready to enjoy both the sunshine _and_ the wonders of Pascal's triangle.
20+
21+
[wikipedia]: https://en.wikipedia.org/wiki/Pascal%27s_triangle
22+
[wikipedia-sierpinski-triangle]: https://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle

exercises/practice/perfect-numbers/.docs/instructions.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,38 @@
22

33
Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers.
44

5-
The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum][aliquot-sum].
6-
The aliquot sum is defined as the sum of the factors of a number not including the number itself.
5+
The Greek mathematician [Nicomachus][nicomachus] devised a classification scheme for positive integers, identifying each as belonging uniquely to the categories of [perfect](#perfect), [abundant](#abundant), or [deficient](#deficient) based on their [aliquot sum][aliquot-sum].
6+
The _aliquot sum_ is defined as the sum of the factors of a number not including the number itself.
77
For example, the aliquot sum of `15` is `1 + 3 + 5 = 9`.
88

9-
- **Perfect**: aliquot sum = number
10-
- 6 is a perfect number because (1 + 2 + 3) = 6
11-
- 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28
12-
- **Abundant**: aliquot sum > number
13-
- 12 is an abundant number because (1 + 2 + 3 + 4 + 6) = 16
14-
- 24 is an abundant number because (1 + 2 + 3 + 4 + 6 + 8 + 12) = 36
15-
- **Deficient**: aliquot sum < number
16-
- 8 is a deficient number because (1 + 2 + 4) = 7
17-
- Prime numbers are deficient
18-
19-
Implement a way to determine whether a given number is **perfect**.
20-
Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**.
9+
## Perfect
10+
11+
A number is perfect when it equals its aliquot sum.
12+
For example:
13+
14+
- `6` is a perfect number because `1 + 2 + 3 = 6`
15+
- `28` is a perfect number because `1 + 2 + 4 + 7 + 14 = 28`
16+
17+
## Abundant
18+
19+
A number is abundant when it is less than its aliquot sum.
20+
For example:
21+
22+
- `12` is an abundant number because `1 + 2 + 3 + 4 + 6 = 16`
23+
- `24` is an abundant number because `1 + 2 + 3 + 4 + 6 + 8 + 12 = 36`
24+
25+
## Deficient
26+
27+
A number is deficient when it is greater than its aliquot sum.
28+
For example:
29+
30+
- `8` is a deficient number because `1 + 2 + 4 = 7`
31+
- Prime numbers are deficient
32+
33+
## Task
34+
35+
Implement a way to determine whether a given number is [perfect](#perfect).
36+
Depending on your language track, you may also need to implement a way to determine whether a given number is [abundant](#abundant) or [deficient](#deficient).
2137

2238
[nicomachus]: https://en.wikipedia.org/wiki/Nicomachus
2339
[aliquot-sum]: https://en.wikipedia.org/wiki/Aliquot_sum

exercises/practice/pig-latin/.docs/instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ For example:
1919

2020
## Rule 2
2121

22-
If a word begins with a one or more consonants, first move those consonants to the end of the word and then add an `"ay"` sound to the end of the word.
22+
If a word begins with one or more consonants, first move those consonants to the end of the word and then add an `"ay"` sound to the end of the word.
2323

2424
For example:
2525

@@ -33,7 +33,7 @@ If a word starts with zero or more consonants followed by `"qu"`, first move tho
3333

3434
For example:
3535

36-
- `"quick"` -> `"ickqu"` -> `"ay"` (starts with `"qu"`, no preceding consonants)
36+
- `"quick"` -> `"ickqu"` -> `"ickquay"` (starts with `"qu"`, no preceding consonants)
3737
- `"square"` -> `"aresqu"` -> `"aresquay"` (starts with one consonant followed by `"qu`")
3838

3939
## Rule 4

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
".meta/example.lua"
1717
]
1818
},
19-
"blurb": "There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product a * b * c.",
19+
"blurb": "There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the triplet.",
2020
"source": "Problem 9 at Project Euler",
2121
"source_url": "https://projecteuler.net/problem=9"
2222
}

0 commit comments

Comments
 (0)