Skip to content

Commit

Permalink
exercises: sync docs for 17 exercises (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
ee7 authored Oct 2, 2023
1 parent 3ef464a commit 5f4664c
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 64 deletions.
10 changes: 5 additions & 5 deletions exercises/practice/acronym/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Punctuation is handled as follows: hyphens are word separators (like whitespace)

For example:

|Input|Output|
|-|-|
|As Soon As Possible|ASAP|
|Liquid-crystal display|LCD|
|Thank George It's Friday!|TGIF|
| Input | Output |
| ------------------------- | ------ |
| As Soon As Possible | ASAP |
| Liquid-crystal display | LCD |
| Thank George It's Friday! | TGIF |
8 changes: 4 additions & 4 deletions exercises/practice/all-your-base/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ Given a number in base **a**, represented as a sequence of digits, convert it to

In positional notation, a number in base **b** can be understood as a linear combination of powers of **b**.

The number 42, *in base 10*, means:
The number 42, _in base 10_, means:

`(4 * 10^1) + (2 * 10^0)`

The number 101010, *in base 2*, means:
The number 101010, _in base 2_, means:

`(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)`

The number 1120, *in base 3*, means:
The number 1120, _in base 3_, means:

`(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0)`

I think you got the idea!

*Yes. Those three numbers above are exactly the same. Congratulations!*
_Yes. Those three numbers above are exactly the same. Congratulations!_

[positional-notation]: https://en.wikipedia.org/wiki/Positional_notation
2 changes: 1 addition & 1 deletion exercises/practice/allergies/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Now, given just that score of 34, your program should be able to say:
- Whether Tom is allergic to any one of those allergens listed above.
- All the allergens Tom is allergic to.

Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.).
Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.).
Your program should ignore those components of the score.
For example, if the allergy score is 257, your program should only report the eggs (1) allergy.
4 changes: 2 additions & 2 deletions exercises/practice/armstrong-numbers/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ An [Armstrong number][armstrong-number] is a number that is the sum of its own d
For example:

- 9 is an Armstrong number, because `9 = 9^1 = 9`
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1`
- 10 is _not_ an Armstrong number, because `10 != 1^2 + 0^2 = 1`
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
- 154 is _not_ an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`

Write some code to determine whether a number is an Armstrong number.

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/binary-search/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Binary search only works when a list has been sorted.

The algorithm looks like this:

- Find the middle element of a *sorted* list and compare it with the item we're looking for.
- Find the middle element of a _sorted_ list and compare it with the item we're looking for.
- If the middle element is our item, then we're done!
- If the middle element is greater than our item, we can eliminate that element and all the elements **after** it.
- If the middle element is less than our item, we can eliminate that element and all the elements **before** it.
Expand Down
8 changes: 8 additions & 0 deletions exercises/practice/darts/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Write a function that returns the earned points in a single toss of a Darts game

In our particular instance of the game, the target rewards 4 different amounts of points, depending on where the dart lands:

![Our dart scoreboard with values from a complete miss to a bullseye](https://assets.exercism.org/images/exercises/darts/darts-scoreboard.svg)

- If the dart lands outside the target, player earns no points (0 points).
- If the dart lands in the outer circle of the target, player earns 1 point.
- If the dart lands in the middle circle of the target, player earns 5 points.
Expand All @@ -16,8 +18,14 @@ Of course, they are all centered at the same point — that is, the circles are

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.

## Credit

The scoreboard image was created by [habere-et-dispertire][habere-et-dispertire] using [Inkscape][inkscape].

[darts]: https://en.wikipedia.org/wiki/Darts
[darts-target]: https://en.wikipedia.org/wiki/Darts#/media/File:Darts_in_a_dartboard.jpg
[concentric]: https://mathworld.wolfram.com/ConcentricCircles.html
[cartesian-coordinates]: https://www.mathsisfun.com/data/cartesian-coordinates.html
[real-numbers]: https://www.mathsisfun.com/numbers/real-numbers.html
[habere-et-dispertire]: https://exercism.org/profiles/habere-et-dispertire
[inkscape]: https://en.wikipedia.org/wiki/Inkscape
2 changes: 1 addition & 1 deletion exercises/practice/isogram/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Examples of isograms:
- downstream
- six-year-old

The word *isograms*, however, is not an isogram, because the s repeats.
The word _isograms_, however, is not an isogram, because the s repeats.
5 changes: 2 additions & 3 deletions exercises/practice/perfect-numbers/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Instructions

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

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].
The aliquot sum is defined as the sum of the factors of a number not including the number itself.
For example, the aliquot sum of 15 is (1 + 3 + 5) = 9
For example, the aliquot sum of `15` is `1 + 3 + 5 = 9`.

- **Perfect**: aliquot sum = number
- 6 is a perfect number because (1 + 2 + 3) = 6
Expand Down
10 changes: 6 additions & 4 deletions exercises/practice/phone-number/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ Clean up user-entered phone numbers so that they can be sent SMS messages.
The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda.
All NANP-countries share the same international country code: `1`.

NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number.
The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*.
NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as _area code_, followed by a seven-digit local number.
The first three digits of the local number represent the _exchange code_, followed by the unique four-digit number which is the _subscriber number_.

The format is usually represented as

```text
(NXX)-NXX-XXXX
NXX NXX-XXXX
```

where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.

Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present.
Sometimes they also have the country code (represented as `1` or `+1`) prefixed.

Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code if present.

For example, the inputs

Expand Down
20 changes: 10 additions & 10 deletions exercises/practice/protein-translation/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ Note the stop codon `"UAA"` terminates the translation and the final methionine

Below are the codons and resulting Amino Acids needed for the exercise.

Codon | Protein
:--- | :---
AUG | Methionine
UUU, UUC | Phenylalanine
UUA, UUG | Leucine
UCU, UCC, UCA, UCG | Serine
UAU, UAC | Tyrosine
UGU, UGC | Cysteine
UGG | Tryptophan
UAA, UAG, UGA | STOP
| Codon | Protein |
| :----------------- | :------------ |
| AUG | Methionine |
| UUU, UUC | Phenylalanine |
| UUA, UUG | Leucine |
| UCU, UCC, UCA, UCG | Serine |
| UAU, UAC | Tyrosine |
| UGU, UGC | Cysteine |
| UGG | Tryptophan |
| UAA, UAG, UGA | STOP |

Learn more about [protein translation on Wikipedia][protein-translation].

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/queen-attack/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ So if you are told the white queen is at `c5` (zero-indexed at column 2, row 3)
a b c d e f g h
```

You are also be able to answer whether the queens can attack each other.
You are also able to answer whether the queens can attack each other.
In this case, that answer would be yes, they can, because both pieces share a diagonal.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For this exercise, you need to know only three things about them:
- Grey: 8
- White: 9

In `resistor-color duo` you decoded the first two colors.
In Resistor Color Duo you decoded the first two colors.
For instance: orange-orange got the main value `33`.
The third color stands for how many zeros need to be added to the main value.
The main value plus the zeros gives us a value in ohms.
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/roman-numerals/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ In Roman numerals 1990 is MCMXC:
2000=MM
8=VIII

Learn more about [Roman numberals on Wikipedia][roman-numerals].
Learn more about [Roman numerals on Wikipedia][roman-numerals].

[roman-numerals]: https://wiki.imperivm-romanvm.com/wiki/Roman_Numerals
4 changes: 2 additions & 2 deletions exercises/practice/rotational-cipher/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Ciphertext is written out in the same formatting as the input including spaces a

## Examples

- ROT5 `omg` gives `trl`
- ROT0 `c` gives `c`
- ROT5 `omg` gives `trl`
- ROT0 `c` gives `c`
- ROT26 `Cool` gives `Cool`
- ROT13 `The quick brown fox jumps over the lazy dog.` gives `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.`
- ROT13 `Gur dhvpx oebja sbk whzcf bire gur ynml qbt.` gives `The quick brown fox jumps over the lazy dog.`
20 changes: 10 additions & 10 deletions exercises/practice/scale-generator/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ Then, for each interval in the pattern, the next note is determined by starting

For example, starting with G and using the seven intervals MMmMMMm, there would be the following eight notes:

Note | Reason
--|--
G | Tonic
A | M indicates a whole step from G, skipping G♯
B | M indicates a whole step from A, skipping A♯
C | m indicates a half step from B, skipping nothing
D | M indicates a whole step from C, skipping C♯
E | M indicates a whole step from D, skipping D♯
F♯ | M indicates a whole step from E, skipping F
G | m indicates a half step from F♯, skipping nothing
| Note | Reason |
| ---- | ------------------------------------------------- |
| G | Tonic |
| A | M indicates a whole step from G, skipping G♯ |
| B | M indicates a whole step from A, skipping A♯ |
| C | m indicates a half step from B, skipping nothing |
| D | M indicates a whole step from C, skipping C♯ |
| E | M indicates a whole step from D, skipping D♯ |
| F♯ | M indicates a whole step from E, skipping F |
| G | m indicates a half step from F♯, skipping nothing |
4 changes: 2 additions & 2 deletions exercises/practice/series/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ And the following 4-digit series:

And if you ask for a 6-digit series from a 5-digit string, you deserve whatever you get.

Note that these series are only required to occupy *adjacent positions* in the input;
the digits need not be *numerically consecutive*.
Note that these series are only required to occupy _adjacent positions_ in the input;
the digits need not be _numerically consecutive_.
32 changes: 16 additions & 16 deletions exercises/practice/yacht/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ The score of a throw of the dice depends on category chosen.

## Scores in Yacht

| Category | Score | Description | Example |
| -------- | ----- | ----------- | ------- |
| Ones | 1 × number of ones | Any combination | 1 1 1 4 5 scores 3 |
| Twos | 2 × number of twos | Any combination | 2 2 3 4 5 scores 4 |
| Threes | 3 × number of threes | Any combination | 3 3 3 3 3 scores 15 |
| Fours | 4 × number of fours | Any combination | 1 2 3 3 5 scores 0 |
| Fives | 5 × number of fives| Any combination | 5 1 5 2 5 scores 15 |
| Sixes | 6 × number of sixes | Any combination | 2 3 4 5 6 scores 6 |
| Full House | Total of the dice | Three of one number and two of another | 3 3 3 5 5 scores 19 |
| Four of a Kind | Total of the four dice | At least four dice showing the same face | 4 4 4 4 6 scores 16 |
| Little Straight | 30 points | 1-2-3-4-5 | 1 2 3 4 5 scores 30 |
| Big Straight | 30 points | 2-3-4-5-6 | 2 3 4 5 6 scores 30 |
| Choice | Sum of the dice | Any combination | 2 3 3 4 6 scores 18 |
| Yacht | 50 points | All five dice showing the same face | 4 4 4 4 4 scores 50 |
| Category | Score | Description | Example |
| --------------- | ---------------------- | ---------------------------------------- | ------------------- |
| Ones | 1 × number of ones | Any combination | 1 1 1 4 5 scores 3 |
| Twos | 2 × number of twos | Any combination | 2 2 3 4 5 scores 4 |
| Threes | 3 × number of threes | Any combination | 3 3 3 3 3 scores 15 |
| Fours | 4 × number of fours | Any combination | 1 2 3 3 5 scores 0 |
| Fives | 5 × number of fives | Any combination | 5 1 5 2 5 scores 15 |
| Sixes | 6 × number of sixes | Any combination | 2 3 4 5 6 scores 6 |
| Full House | Total of the dice | Three of one number and two of another | 3 3 3 5 5 scores 19 |
| Four of a Kind | Total of the four dice | At least four dice showing the same face | 4 4 4 4 6 scores 16 |
| Little Straight | 30 points | 1-2-3-4-5 | 1 2 3 4 5 scores 30 |
| Big Straight | 30 points | 2-3-4-5-6 | 2 3 4 5 6 scores 30 |
| Choice | Sum of the dice | Any combination | 2 3 3 4 6 scores 18 |
| Yacht | 50 points | All five dice showing the same face | 4 4 4 4 4 scores 50 |

If the dice do not satisfy the requirements of a category, the score is zero.
If, for example, *Four Of A Kind* is entered in the *Yacht* category, zero points are scored.
A *Yacht* scores zero if entered in the *Full House* category.
If, for example, _Four Of A Kind_ is entered in the _Yacht_ category, zero points are scored.
A _Yacht_ scores zero if entered in the _Full House_ category.

## Task

Expand Down

0 comments on commit 5f4664c

Please sign in to comment.