Skip to content

Commit a9ef6da

Browse files
authored
Add bottle-song, deprecating beer-song (#285)
1 parent 0593647 commit a9ef6da

File tree

9 files changed

+917
-2
lines changed

9 files changed

+917
-2
lines changed

config.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,8 @@
549549
"uuid": "9dba8bd0-c964-4320-a2a6-2202c8f3fdfe",
550550
"practices": [],
551551
"prerequisites": [],
552-
"difficulty": 5
552+
"difficulty": 5,
553+
"status": "deprecated"
553554
},
554555
{
555556
"slug": "binary-search",
@@ -559,6 +560,14 @@
559560
"prerequisites": [],
560561
"difficulty": 5
561562
},
563+
{
564+
"slug": "bottle-song",
565+
"name": "Bottle Song",
566+
"uuid": "13a434bf-15e0-49e4-860a-988d3a5c1238",
567+
"practices": [],
568+
"prerequisites": [],
569+
"difficulty": 5
570+
},
562571
{
563572
"slug": "diamond",
564573
"name": "Diamond",
@@ -801,7 +810,7 @@
801810
"practices": [],
802811
"prerequisites": [],
803812
"difficulty": 9,
804-
"status": "deprecated"
813+
"status": "deprecated"
805814
},
806815
{
807816
"slug": "two-bucket",
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Instructions
2+
3+
Recite the lyrics to that popular children's repetitive song: Ten Green Bottles.
4+
5+
Note that not all verses are identical.
6+
7+
```text
8+
Ten green bottles hanging on the wall,
9+
Ten green bottles hanging on the wall,
10+
And if one green bottle should accidentally fall,
11+
There'll be nine green bottles hanging on the wall.
12+
13+
Nine green bottles hanging on the wall,
14+
Nine green bottles hanging on the wall,
15+
And if one green bottle should accidentally fall,
16+
There'll be eight green bottles hanging on the wall.
17+
18+
Eight green bottles hanging on the wall,
19+
Eight green bottles hanging on the wall,
20+
And if one green bottle should accidentally fall,
21+
There'll be seven green bottles hanging on the wall.
22+
23+
Seven green bottles hanging on the wall,
24+
Seven green bottles hanging on the wall,
25+
And if one green bottle should accidentally fall,
26+
There'll be six green bottles hanging on the wall.
27+
28+
Six green bottles hanging on the wall,
29+
Six green bottles hanging on the wall,
30+
And if one green bottle should accidentally fall,
31+
There'll be five green bottles hanging on the wall.
32+
33+
Five green bottles hanging on the wall,
34+
Five green bottles hanging on the wall,
35+
And if one green bottle should accidentally fall,
36+
There'll be four green bottles hanging on the wall.
37+
38+
Four green bottles hanging on the wall,
39+
Four green bottles hanging on the wall,
40+
And if one green bottle should accidentally fall,
41+
There'll be three green bottles hanging on the wall.
42+
43+
Three green bottles hanging on the wall,
44+
Three green bottles hanging on the wall,
45+
And if one green bottle should accidentally fall,
46+
There'll be two green bottles hanging on the wall.
47+
48+
Two green bottles hanging on the wall,
49+
Two green bottles hanging on the wall,
50+
And if one green bottle should accidentally fall,
51+
There'll be one green bottle hanging on the wall.
52+
53+
One green bottle hanging on the wall,
54+
One green bottle hanging on the wall,
55+
And if one green bottle should accidentally fall,
56+
There'll be no green bottles hanging on the wall.
57+
```
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"authors": [
3+
"glennj"
4+
],
5+
"files": {
6+
"solution": [
7+
"bottle-song.jq"
8+
],
9+
"test": [
10+
"test-bottle-song.bats"
11+
],
12+
"example": [
13+
".meta/example.jq"
14+
]
15+
},
16+
"blurb": "Produce the lyrics to the popular children's repetitive song: Ten Green Bottles.",
17+
"source": "Wikipedia",
18+
"source_url": "https://en.wikipedia.org/wiki/Ten_Green_Bottles"
19+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def bottles:
2+
[ "No", "One", "Two", "Three", "Four",
3+
"Five", "Six", "Seven", "Eight", "Nine", "Ten" ][.]
4+
+ " green bottle"
5+
+ (if . == 1 then "" else "s" end);
6+
7+
def line1:
8+
"\(bottles) hanging on the wall,";
9+
10+
def line2:
11+
"There'll be \(. - 1 | bottles | ascii_downcase) hanging on the wall.";
12+
13+
[
14+
range(.startBottles; .startBottles - .takeDown; -1)
15+
| [ "",
16+
line1,
17+
line1,
18+
"And if one green bottle should accidentally fall,",
19+
line2
20+
]
21+
]
22+
| add
23+
| .[1:]
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
11+
12+
[d4ccf8fc-01dc-48c0-a201-4fbeb30f2d03]
13+
description = "verse -> single verse -> first generic verse"
14+
15+
[0f0aded3-472a-4c64-b842-18d4f1f5f030]
16+
description = "verse -> single verse -> last generic verse"
17+
18+
[f61f3c97-131f-459e-b40a-7428f3ed99d9]
19+
description = "verse -> single verse -> verse with 2 bottles"
20+
21+
[05eadba9-5dbd-401e-a7e8-d17cc9baa8e0]
22+
description = "verse -> single verse -> verse with 1 bottle"
23+
24+
[a4a28170-83d6-4dc1-bd8b-319b6abb6a80]
25+
description = "lyrics -> multiple verses -> first two verses"
26+
27+
[3185d438-c5ac-4ce6-bcd3-02c9ff1ed8db]
28+
description = "lyrics -> multiple verses -> last three verses"
29+
30+
[28c1584a-0e51-4b65-9ae2-fbc0bf4bbb28]
31+
description = "lyrics -> multiple verses -> all verses"

0 commit comments

Comments
 (0)