Skip to content

Commit 44658d3

Browse files
ErikSchierboomiHiD
authored andcommitted
[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 a7d8a5c commit 44658d3

File tree

20 files changed

+776
-0
lines changed

20 files changed

+776
-0
lines changed
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: 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: 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: 321 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,321 @@
1+
# Instructions
2+
3+
Recite the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
4+
5+
Note that not all verses are identical.
6+
7+
```text
8+
99 bottles of beer on the wall, 99 bottles of beer.
9+
Take one down and pass it around, 98 bottles of beer on the wall.
10+
11+
98 bottles of beer on the wall, 98 bottles of beer.
12+
Take one down and pass it around, 97 bottles of beer on the wall.
13+
14+
97 bottles of beer on the wall, 97 bottles of beer.
15+
Take one down and pass it around, 96 bottles of beer on the wall.
16+
17+
96 bottles of beer on the wall, 96 bottles of beer.
18+
Take one down and pass it around, 95 bottles of beer on the wall.
19+
20+
95 bottles of beer on the wall, 95 bottles of beer.
21+
Take one down and pass it around, 94 bottles of beer on the wall.
22+
23+
94 bottles of beer on the wall, 94 bottles of beer.
24+
Take one down and pass it around, 93 bottles of beer on the wall.
25+
26+
93 bottles of beer on the wall, 93 bottles of beer.
27+
Take one down and pass it around, 92 bottles of beer on the wall.
28+
29+
92 bottles of beer on the wall, 92 bottles of beer.
30+
Take one down and pass it around, 91 bottles of beer on the wall.
31+
32+
91 bottles of beer on the wall, 91 bottles of beer.
33+
Take one down and pass it around, 90 bottles of beer on the wall.
34+
35+
90 bottles of beer on the wall, 90 bottles of beer.
36+
Take one down and pass it around, 89 bottles of beer on the wall.
37+
38+
89 bottles of beer on the wall, 89 bottles of beer.
39+
Take one down and pass it around, 88 bottles of beer on the wall.
40+
41+
88 bottles of beer on the wall, 88 bottles of beer.
42+
Take one down and pass it around, 87 bottles of beer on the wall.
43+
44+
87 bottles of beer on the wall, 87 bottles of beer.
45+
Take one down and pass it around, 86 bottles of beer on the wall.
46+
47+
86 bottles of beer on the wall, 86 bottles of beer.
48+
Take one down and pass it around, 85 bottles of beer on the wall.
49+
50+
85 bottles of beer on the wall, 85 bottles of beer.
51+
Take one down and pass it around, 84 bottles of beer on the wall.
52+
53+
84 bottles of beer on the wall, 84 bottles of beer.
54+
Take one down and pass it around, 83 bottles of beer on the wall.
55+
56+
83 bottles of beer on the wall, 83 bottles of beer.
57+
Take one down and pass it around, 82 bottles of beer on the wall.
58+
59+
82 bottles of beer on the wall, 82 bottles of beer.
60+
Take one down and pass it around, 81 bottles of beer on the wall.
61+
62+
81 bottles of beer on the wall, 81 bottles of beer.
63+
Take one down and pass it around, 80 bottles of beer on the wall.
64+
65+
80 bottles of beer on the wall, 80 bottles of beer.
66+
Take one down and pass it around, 79 bottles of beer on the wall.
67+
68+
79 bottles of beer on the wall, 79 bottles of beer.
69+
Take one down and pass it around, 78 bottles of beer on the wall.
70+
71+
78 bottles of beer on the wall, 78 bottles of beer.
72+
Take one down and pass it around, 77 bottles of beer on the wall.
73+
74+
77 bottles of beer on the wall, 77 bottles of beer.
75+
Take one down and pass it around, 76 bottles of beer on the wall.
76+
77+
76 bottles of beer on the wall, 76 bottles of beer.
78+
Take one down and pass it around, 75 bottles of beer on the wall.
79+
80+
75 bottles of beer on the wall, 75 bottles of beer.
81+
Take one down and pass it around, 74 bottles of beer on the wall.
82+
83+
74 bottles of beer on the wall, 74 bottles of beer.
84+
Take one down and pass it around, 73 bottles of beer on the wall.
85+
86+
73 bottles of beer on the wall, 73 bottles of beer.
87+
Take one down and pass it around, 72 bottles of beer on the wall.
88+
89+
72 bottles of beer on the wall, 72 bottles of beer.
90+
Take one down and pass it around, 71 bottles of beer on the wall.
91+
92+
71 bottles of beer on the wall, 71 bottles of beer.
93+
Take one down and pass it around, 70 bottles of beer on the wall.
94+
95+
70 bottles of beer on the wall, 70 bottles of beer.
96+
Take one down and pass it around, 69 bottles of beer on the wall.
97+
98+
69 bottles of beer on the wall, 69 bottles of beer.
99+
Take one down and pass it around, 68 bottles of beer on the wall.
100+
101+
68 bottles of beer on the wall, 68 bottles of beer.
102+
Take one down and pass it around, 67 bottles of beer on the wall.
103+
104+
67 bottles of beer on the wall, 67 bottles of beer.
105+
Take one down and pass it around, 66 bottles of beer on the wall.
106+
107+
66 bottles of beer on the wall, 66 bottles of beer.
108+
Take one down and pass it around, 65 bottles of beer on the wall.
109+
110+
65 bottles of beer on the wall, 65 bottles of beer.
111+
Take one down and pass it around, 64 bottles of beer on the wall.
112+
113+
64 bottles of beer on the wall, 64 bottles of beer.
114+
Take one down and pass it around, 63 bottles of beer on the wall.
115+
116+
63 bottles of beer on the wall, 63 bottles of beer.
117+
Take one down and pass it around, 62 bottles of beer on the wall.
118+
119+
62 bottles of beer on the wall, 62 bottles of beer.
120+
Take one down and pass it around, 61 bottles of beer on the wall.
121+
122+
61 bottles of beer on the wall, 61 bottles of beer.
123+
Take one down and pass it around, 60 bottles of beer on the wall.
124+
125+
60 bottles of beer on the wall, 60 bottles of beer.
126+
Take one down and pass it around, 59 bottles of beer on the wall.
127+
128+
59 bottles of beer on the wall, 59 bottles of beer.
129+
Take one down and pass it around, 58 bottles of beer on the wall.
130+
131+
58 bottles of beer on the wall, 58 bottles of beer.
132+
Take one down and pass it around, 57 bottles of beer on the wall.
133+
134+
57 bottles of beer on the wall, 57 bottles of beer.
135+
Take one down and pass it around, 56 bottles of beer on the wall.
136+
137+
56 bottles of beer on the wall, 56 bottles of beer.
138+
Take one down and pass it around, 55 bottles of beer on the wall.
139+
140+
55 bottles of beer on the wall, 55 bottles of beer.
141+
Take one down and pass it around, 54 bottles of beer on the wall.
142+
143+
54 bottles of beer on the wall, 54 bottles of beer.
144+
Take one down and pass it around, 53 bottles of beer on the wall.
145+
146+
53 bottles of beer on the wall, 53 bottles of beer.
147+
Take one down and pass it around, 52 bottles of beer on the wall.
148+
149+
52 bottles of beer on the wall, 52 bottles of beer.
150+
Take one down and pass it around, 51 bottles of beer on the wall.
151+
152+
51 bottles of beer on the wall, 51 bottles of beer.
153+
Take one down and pass it around, 50 bottles of beer on the wall.
154+
155+
50 bottles of beer on the wall, 50 bottles of beer.
156+
Take one down and pass it around, 49 bottles of beer on the wall.
157+
158+
49 bottles of beer on the wall, 49 bottles of beer.
159+
Take one down and pass it around, 48 bottles of beer on the wall.
160+
161+
48 bottles of beer on the wall, 48 bottles of beer.
162+
Take one down and pass it around, 47 bottles of beer on the wall.
163+
164+
47 bottles of beer on the wall, 47 bottles of beer.
165+
Take one down and pass it around, 46 bottles of beer on the wall.
166+
167+
46 bottles of beer on the wall, 46 bottles of beer.
168+
Take one down and pass it around, 45 bottles of beer on the wall.
169+
170+
45 bottles of beer on the wall, 45 bottles of beer.
171+
Take one down and pass it around, 44 bottles of beer on the wall.
172+
173+
44 bottles of beer on the wall, 44 bottles of beer.
174+
Take one down and pass it around, 43 bottles of beer on the wall.
175+
176+
43 bottles of beer on the wall, 43 bottles of beer.
177+
Take one down and pass it around, 42 bottles of beer on the wall.
178+
179+
42 bottles of beer on the wall, 42 bottles of beer.
180+
Take one down and pass it around, 41 bottles of beer on the wall.
181+
182+
41 bottles of beer on the wall, 41 bottles of beer.
183+
Take one down and pass it around, 40 bottles of beer on the wall.
184+
185+
40 bottles of beer on the wall, 40 bottles of beer.
186+
Take one down and pass it around, 39 bottles of beer on the wall.
187+
188+
39 bottles of beer on the wall, 39 bottles of beer.
189+
Take one down and pass it around, 38 bottles of beer on the wall.
190+
191+
38 bottles of beer on the wall, 38 bottles of beer.
192+
Take one down and pass it around, 37 bottles of beer on the wall.
193+
194+
37 bottles of beer on the wall, 37 bottles of beer.
195+
Take one down and pass it around, 36 bottles of beer on the wall.
196+
197+
36 bottles of beer on the wall, 36 bottles of beer.
198+
Take one down and pass it around, 35 bottles of beer on the wall.
199+
200+
35 bottles of beer on the wall, 35 bottles of beer.
201+
Take one down and pass it around, 34 bottles of beer on the wall.
202+
203+
34 bottles of beer on the wall, 34 bottles of beer.
204+
Take one down and pass it around, 33 bottles of beer on the wall.
205+
206+
33 bottles of beer on the wall, 33 bottles of beer.
207+
Take one down and pass it around, 32 bottles of beer on the wall.
208+
209+
32 bottles of beer on the wall, 32 bottles of beer.
210+
Take one down and pass it around, 31 bottles of beer on the wall.
211+
212+
31 bottles of beer on the wall, 31 bottles of beer.
213+
Take one down and pass it around, 30 bottles of beer on the wall.
214+
215+
30 bottles of beer on the wall, 30 bottles of beer.
216+
Take one down and pass it around, 29 bottles of beer on the wall.
217+
218+
29 bottles of beer on the wall, 29 bottles of beer.
219+
Take one down and pass it around, 28 bottles of beer on the wall.
220+
221+
28 bottles of beer on the wall, 28 bottles of beer.
222+
Take one down and pass it around, 27 bottles of beer on the wall.
223+
224+
27 bottles of beer on the wall, 27 bottles of beer.
225+
Take one down and pass it around, 26 bottles of beer on the wall.
226+
227+
26 bottles of beer on the wall, 26 bottles of beer.
228+
Take one down and pass it around, 25 bottles of beer on the wall.
229+
230+
25 bottles of beer on the wall, 25 bottles of beer.
231+
Take one down and pass it around, 24 bottles of beer on the wall.
232+
233+
24 bottles of beer on the wall, 24 bottles of beer.
234+
Take one down and pass it around, 23 bottles of beer on the wall.
235+
236+
23 bottles of beer on the wall, 23 bottles of beer.
237+
Take one down and pass it around, 22 bottles of beer on the wall.
238+
239+
22 bottles of beer on the wall, 22 bottles of beer.
240+
Take one down and pass it around, 21 bottles of beer on the wall.
241+
242+
21 bottles of beer on the wall, 21 bottles of beer.
243+
Take one down and pass it around, 20 bottles of beer on the wall.
244+
245+
20 bottles of beer on the wall, 20 bottles of beer.
246+
Take one down and pass it around, 19 bottles of beer on the wall.
247+
248+
19 bottles of beer on the wall, 19 bottles of beer.
249+
Take one down and pass it around, 18 bottles of beer on the wall.
250+
251+
18 bottles of beer on the wall, 18 bottles of beer.
252+
Take one down and pass it around, 17 bottles of beer on the wall.
253+
254+
17 bottles of beer on the wall, 17 bottles of beer.
255+
Take one down and pass it around, 16 bottles of beer on the wall.
256+
257+
16 bottles of beer on the wall, 16 bottles of beer.
258+
Take one down and pass it around, 15 bottles of beer on the wall.
259+
260+
15 bottles of beer on the wall, 15 bottles of beer.
261+
Take one down and pass it around, 14 bottles of beer on the wall.
262+
263+
14 bottles of beer on the wall, 14 bottles of beer.
264+
Take one down and pass it around, 13 bottles of beer on the wall.
265+
266+
13 bottles of beer on the wall, 13 bottles of beer.
267+
Take one down and pass it around, 12 bottles of beer on the wall.
268+
269+
12 bottles of beer on the wall, 12 bottles of beer.
270+
Take one down and pass it around, 11 bottles of beer on the wall.
271+
272+
11 bottles of beer on the wall, 11 bottles of beer.
273+
Take one down and pass it around, 10 bottles of beer on the wall.
274+
275+
10 bottles of beer on the wall, 10 bottles of beer.
276+
Take one down and pass it around, 9 bottles of beer on the wall.
277+
278+
9 bottles of beer on the wall, 9 bottles of beer.
279+
Take one down and pass it around, 8 bottles of beer on the wall.
280+
281+
8 bottles of beer on the wall, 8 bottles of beer.
282+
Take one down and pass it around, 7 bottles of beer on the wall.
283+
284+
7 bottles of beer on the wall, 7 bottles of beer.
285+
Take one down and pass it around, 6 bottles of beer on the wall.
286+
287+
6 bottles of beer on the wall, 6 bottles of beer.
288+
Take one down and pass it around, 5 bottles of beer on the wall.
289+
290+
5 bottles of beer on the wall, 5 bottles of beer.
291+
Take one down and pass it around, 4 bottles of beer on the wall.
292+
293+
4 bottles of beer on the wall, 4 bottles of beer.
294+
Take one down and pass it around, 3 bottles of beer on the wall.
295+
296+
3 bottles of beer on the wall, 3 bottles of beer.
297+
Take one down and pass it around, 2 bottles of beer on the wall.
298+
299+
2 bottles of beer on the wall, 2 bottles of beer.
300+
Take one down and pass it around, 1 bottle of beer on the wall.
301+
302+
1 bottle of beer on the wall, 1 bottle of beer.
303+
Take it down and pass it around, no more bottles of beer on the wall.
304+
305+
No more bottles of beer on the wall, no more bottles of beer.
306+
Go to the store and buy some more, 99 bottles of beer on the wall.
307+
```
308+
309+
## For bonus points
310+
311+
Did you get the tests passing and the code clean? If you want to, these
312+
are some additional things you could try:
313+
314+
* Remove as much duplication as you possibly can.
315+
* Optimize for readability, even if it means introducing duplication.
316+
* If you've removed all the duplication, do you have a lot of
317+
conditionals? Try replacing the conditionals with polymorphism, if it
318+
applies in this language. How readable is it?
319+
320+
Then please share your thoughts in a comment on the submission. Did this
321+
experiment make the code better? Worse? Did you learn anything from it?

0 commit comments

Comments
 (0)