Skip to content

Commit d18ac65

Browse files
[v3] Create instruction from prob-specs descriptions
Practice Exercises in Exercism v3 will be structured differently. One such change is that there won't be a (generated) README.md file anymore. This file will be replaced by `.docs/instructions.md` and optionally a `.docs/introduction.md` files. These files are copies of the information defined for their corresponding problem-specifications exercise (if any). The `.docs/instructions.md` file is a copy of the `instructions.md` file of the problem-specifications exercise, or if that does not exists, its `description.md` file. The new [configlet](https://github.com/exercism/configlet) version will add support for doing this syncing automatically. See [the spec](https://github.com/exercism/docs/blob/main/anatomy/tracks/practice-exercises.md) for more information.
1 parent ad11611 commit d18ac65

File tree

94 files changed

+3121
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+3121
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Instructions
2+
3+
Implement the `accumulate` operation, which, given a collection and an
4+
operation to perform on each element of the collection, returns a new
5+
collection containing the result of applying that operation to each element of
6+
the input collection.
7+
8+
Given the collection of numbers:
9+
10+
- 1, 2, 3, 4, 5
11+
12+
And the operation:
13+
14+
- square a number (`x => x * x`)
15+
16+
Your code should be able to produce the collection of squares:
17+
18+
- 1, 4, 9, 16, 25
19+
20+
Check out the test suite to see the expected function signature.
21+
22+
## Restrictions
23+
24+
Keep your hands off that collect/map/fmap/whatchamacallit functionality
25+
provided by your standard library!
26+
Solve this one yourself using other basic tools instead.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Instructions
2+
3+
Convert a phrase to its acronym.
4+
5+
Techies love their TLA (Three Letter Acronyms)!
6+
7+
Help generate some jargon by writing a program that converts a long name
8+
like Portable Network Graphics to its acronym (PNG).
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Instructions
2+
3+
Convert a number, represented as a sequence of digits in one base, to any other base.
4+
5+
Implement general base conversion. Given a number in base **a**,
6+
represented as a sequence of digits, convert it to base **b**.
7+
8+
## Note
9+
10+
- Try to implement the conversion yourself.
11+
Do not use something else to perform the conversion for you.
12+
13+
## About [Positional Notation](https://en.wikipedia.org/wiki/Positional_notation)
14+
15+
In positional notation, a number in base **b** can be understood as a linear
16+
combination of powers of **b**.
17+
18+
The number 42, *in base 10*, means:
19+
20+
(4 * 10^1) + (2 * 10^0)
21+
22+
The number 101010, *in base 2*, means:
23+
24+
(1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)
25+
26+
The number 1120, *in base 3*, means:
27+
28+
(1 * 3^3) + (1 * 3^2) + (2 * 3^1) + (0 * 3^0)
29+
30+
I think you got the idea!
31+
32+
*Yes. Those three numbers above are exactly the same. Congratulations!*
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Instructions
2+
3+
Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies.
4+
5+
An allergy test produces a single numeric score which contains the
6+
information about all the allergies the person has (that they were
7+
tested for).
8+
9+
The list of items (and their value) that were tested are:
10+
11+
* eggs (1)
12+
* peanuts (2)
13+
* shellfish (4)
14+
* strawberries (8)
15+
* tomatoes (16)
16+
* chocolate (32)
17+
* pollen (64)
18+
* cats (128)
19+
20+
So if Tom is allergic to peanuts and chocolate, he gets a score of 34.
21+
22+
Now, given just that score of 34, your program should be able to say:
23+
24+
- Whether Tom is allergic to any one of those allergens listed above.
25+
- All the allergens Tom is allergic to.
26+
27+
Note: a given score may include allergens **not** listed above (i.e.
28+
allergens that score 256, 512, 1024, etc.). Your program should
29+
ignore those components of the score. For example, if the allergy
30+
score is 257, your program should only report the eggs (1) allergy.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Instructions
2+
3+
Write a function to solve alphametics puzzles.
4+
5+
[Alphametics](https://en.wikipedia.org/wiki/Alphametics) is a puzzle where
6+
letters in words are replaced with numbers.
7+
8+
For example `SEND + MORE = MONEY`:
9+
10+
```text
11+
S E N D
12+
M O R E +
13+
-----------
14+
M O N E Y
15+
```
16+
17+
Replacing these with valid numbers gives:
18+
19+
```text
20+
9 5 6 7
21+
1 0 8 5 +
22+
-----------
23+
1 0 6 5 2
24+
```
25+
26+
This is correct because every letter is replaced by a different number and the
27+
words, translated into numbers, then make a valid sum.
28+
29+
Each letter must represent a different digit, and the leading digit of
30+
a multi-digit number must not be zero.
31+
32+
Write a function to solve alphametics puzzles.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Instructions
2+
3+
An anagram is a rearrangement of letters to form a new word.
4+
Given a word and a list of candidates, select the sublist of anagrams of the given word.
5+
6+
Given `"listen"` and a list of candidates like `"enlists" "google"
7+
"inlets" "banana"` the program should return a list containing
8+
`"inlets"`.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Instructions
2+
3+
An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits.
4+
5+
For example:
6+
7+
- 9 is an Armstrong number, because `9 = 9^1 = 9`
8+
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1`
9+
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
10+
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
11+
12+
Write some code to determine whether a number is an Armstrong number.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Instructions
2+
3+
Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
4+
5+
The Atbash cipher is a simple substitution cipher that relies on
6+
transposing all the letters in the alphabet such that the resulting
7+
alphabet is backwards. The first letter is replaced with the last
8+
letter, the second with the second-last, and so on.
9+
10+
An Atbash cipher for the Latin alphabet would be as follows:
11+
12+
```text
13+
Plain: abcdefghijklmnopqrstuvwxyz
14+
Cipher: zyxwvutsrqponmlkjihgfedcba
15+
```
16+
17+
It is a very weak cipher because it only has one possible key, and it is
18+
a simple monoalphabetic substitution cipher. However, this may not have
19+
been an issue in the cipher's time.
20+
21+
Ciphertext is written out in groups of fixed length, the traditional group size
22+
being 5 letters, and punctuation is excluded. This is to make it harder to guess
23+
things based on word boundaries.
24+
25+
## Examples
26+
27+
- Encoding `test` gives `gvhg`
28+
- Decoding `gvhg` gives `test`
29+
- Decoding `gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt` gives `thequickbrownfoxjumpsoverthelazydog`
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Instructions
2+
3+
Simulate a bank account supporting opening/closing, withdrawals, and deposits
4+
of money. Watch out for concurrent transactions!
5+
6+
A bank account can be accessed in multiple ways. Clients can make
7+
deposits and withdrawals using the internet, mobile phones, etc. Shops
8+
can charge against the account.
9+
10+
Create an account that can be accessed from multiple threads/processes
11+
(terminology depends on your programming language).
12+
13+
It should be possible to close an account; operations against a closed
14+
account must fail.
15+
16+
## Instructions
17+
18+
Run the test file, and fix each of the errors in turn. When you get the
19+
first test to pass, go to the first pending or skipped test, and make
20+
that pass as well. When all of the tests are passing, feel free to
21+
submit.
22+
23+
Remember that passing code is just the first step. The goal is to work
24+
towards a solution that is as readable and expressive as you can make
25+
it.
26+
27+
Have fun!

0 commit comments

Comments
 (0)