Skip to content

Beer song is deprecated #860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 57 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d7ddfd2
Simplify anagram exercise instructions
Apr 28, 2025
0121fb6
Fix capitalization of "Atbash" in instructions
Apr 28, 2025
403584c
Refine instructions formatting and examples for clarity.
Apr 28, 2025
8c49b81
Simplify Collatz Conjecture instructions text
Apr 28, 2025
b421944
Update complex number instructions with detailed explanations
Apr 28, 2025
38e0723
Simplify and clarify domino chain instructions.
Apr 28, 2025
3740aaa
Simplify and clarify flatten-array instructions
Apr 28, 2025
ccd4c9c
Update grade-school instructions for grammar and clarity
Apr 28, 2025
a504e4f
Simplify grains exercise instructions
Apr 28, 2025
6c58737
Simplify Hamming exercise instructions
Apr 28, 2025
4b2df9c
Clarify Luhn algorithm instructions and examples
Apr 28, 2025
d52f3ea
Update instructions to clarify six week values
Apr 28, 2025
b8d6575
Simplify instructions for phone number cleanup task.
Apr 28, 2025
fc5713a
Clarify terminology in protein translation instructions.
Apr 28, 2025
152ff37
Rename "Instructions" to "Description" in documentation
Apr 28, 2025
538ae65
Fix typos and improve punctuation in instructions
Apr 28, 2025
8beb488
Clarify grid visualization in saddle points example.
Apr 28, 2025
c508bcc
Update Sieve instructions for clarity and detailed examples
Apr 28, 2025
f11e8d4
Normalize "Caesar cipher" capitalization in documentation
Apr 28, 2025
d25063a
Clarify definition of sublist and superlist.
Apr 28, 2025
9d58f61
Fix typo in Pascal's Triangle introduction text
Apr 28, 2025
4be4803
Add script to scaffold practice exercises
May 14, 2025
d51ebea
Add "Bottle Song" exercise to config.json
May 14, 2025
b0172be
Add build.sbt for Bottle Song practice exercise
May 14, 2025
b445ca5
Add tests for BottleSong recitation functionality
May 14, 2025
d6eed1f
Add BottleSong exercise with implementation and tests
May 14, 2025
8054050
Add instructions for the "bottle song" practice exercise
May 14, 2025
6ff71fc
Add metadata config for 'Bottle Song' practice exercise
May 14, 2025
56177cc
Add example implementation for Bottle Song practice exercise
May 14, 2025
6c980e4
Add sbt build properties file for bottle-song project
May 14, 2025
539cdaf
Mark BottleSongTest cases as pending.
May 14, 2025
95e8e55
Remove unused topics attribute from config.json
May 14, 2025
56204dd
Remove unused add-practice-exercise script
May 14, 2025
e5bb824
Update CI workflow to use Ubuntu 22.04
May 14, 2025
a65b422
Simplify anagram exercise instructions
Apr 28, 2025
a4e7ac9
Fix capitalization of "Atbash" in instructions
Apr 28, 2025
9d490f2
Refine instructions formatting and examples for clarity.
Apr 28, 2025
8c7bfef
Simplify Collatz Conjecture instructions text
Apr 28, 2025
de7f20c
Update complex number instructions with detailed explanations
Apr 28, 2025
d687ca1
Simplify and clarify domino chain instructions.
Apr 28, 2025
01b506f
Simplify and clarify flatten-array instructions
Apr 28, 2025
8862d47
Update grade-school instructions for grammar and clarity
Apr 28, 2025
9f86fd9
Simplify grains exercise instructions
Apr 28, 2025
ae894b4
Simplify Hamming exercise instructions
Apr 28, 2025
b0bd7be
Clarify Luhn algorithm instructions and examples
Apr 28, 2025
ea65e49
Update instructions to clarify six week values
Apr 28, 2025
4f6f941
Simplify instructions for phone number cleanup task.
Apr 28, 2025
59084ed
Clarify terminology in protein translation instructions.
Apr 28, 2025
253530d
Rename "Instructions" to "Description" in documentation
Apr 28, 2025
1a08cff
Fix typos and improve punctuation in instructions
Apr 28, 2025
eb42513
Clarify grid visualization in saddle points example.
Apr 28, 2025
864a2d2
Update Sieve instructions for clarity and detailed examples
Apr 28, 2025
ad8cf42
Normalize "Caesar cipher" capitalization in documentation
Apr 28, 2025
896f9f2
Clarify definition of sublist and superlist.
Apr 28, 2025
c055287
Fix typo in Pascal's Triangle introduction text
Apr 28, 2025
427458a
Merge remote-tracking branch 'origin/sync' into sync
May 16, 2025
eb3af07
Beer-song is deprecated
May 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
ci:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand Down
9 changes: 9 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
"practices": [],
"prerequisites": [],
"difficulty": 3,
"status": "deprecated",
"topics": [
"algorithms",
"control_flow",
Expand Down Expand Up @@ -1282,6 +1283,14 @@
"practices": [],
"prerequisites": [],
"difficulty": 3
},
{
"slug": "bottle-song",
"name": "Bottle Song",
"uuid": "0c786feb-8653-4215-9281-2e1c83afeefe",
"practices": [],
"prerequisites": [],
"difficulty": 3
}
]
},
Expand Down
11 changes: 5 additions & 6 deletions exercises/practice/anagram/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Instructions

Your task is to, given a target word and a set of candidate words, to find the subset of the candidates that are anagrams of the target.
Given a target word and one or more candidate words, your task is to find the candidates that are anagrams of the target.

An anagram is a rearrangement of letters to form a new word: for example `"owns"` is an anagram of `"snow"`.
A word is _not_ its own anagram: for example, `"stop"` is not an anagram of `"stop"`.

The target and candidates are words of one or more ASCII alphabetic characters (`A`-`Z` and `a`-`z`).
Lowercase and uppercase characters are equivalent: for example, `"PoTS"` is an anagram of `"sTOp"`, but `StoP` is not an anagram of `sTOp`.
The anagram set is the subset of the candidate set that are anagrams of the target (in any order).
Words in the anagram set should have the same letter case as in the candidate set.
The target word and candidate words are made up of one or more ASCII alphabetic characters (`A`-`Z` and `a`-`z`).
Lowercase and uppercase characters are equivalent: for example, `"PoTS"` is an anagram of `"sTOp"`, but `"StoP"` is not an anagram of `"sTOp"`.
The words you need to find should be taken from the candidate words, using the same letter case.

Given the target `"stone"` and candidates `"stone"`, `"tones"`, `"banana"`, `"tons"`, `"notes"`, `"Seton"`, the anagram set is `"tones"`, `"notes"`, `"Seton"`.
Given the target `"stone"` and the candidate words `"stone"`, `"tones"`, `"banana"`, `"tons"`, `"notes"`, and `"Seton"`, the anagram words you need to find are `"tones"`, `"notes"`, and `"Seton"`.
2 changes: 1 addition & 1 deletion exercises/practice/atbash-cipher/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Instructions

Create an implementation of the atbash cipher, an ancient encryption system created in the Middle East.
Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.

The Atbash cipher is a simple substitution cipher that relies on transposing all the letters in the alphabet such that the resulting alphabet is backwards.
The first letter is replaced with the last letter, the second with the second-last, and so on.
Expand Down
57 changes: 57 additions & 0 deletions exercises/practice/bottle-song/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Instructions

Recite the lyrics to that popular children's repetitive song: Ten Green Bottles.

Note that not all verses are identical.

```text
Ten green bottles hanging on the wall,
Ten green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be nine green bottles hanging on the wall.

Nine green bottles hanging on the wall,
Nine green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be eight green bottles hanging on the wall.

Eight green bottles hanging on the wall,
Eight green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be seven green bottles hanging on the wall.

Seven green bottles hanging on the wall,
Seven green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be six green bottles hanging on the wall.

Six green bottles hanging on the wall,
Six green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be five green bottles hanging on the wall.

Five green bottles hanging on the wall,
Five green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be four green bottles hanging on the wall.

Four green bottles hanging on the wall,
Four green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be three green bottles hanging on the wall.

Three green bottles hanging on the wall,
Three green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be two green bottles hanging on the wall.

Two green bottles hanging on the wall,
Two green bottles hanging on the wall,
And if one green bottle should accidentally fall,
There'll be one green bottle hanging on the wall.

One green bottle hanging on the wall,
One green bottle hanging on the wall,
And if one green bottle should accidentally fall,
There'll be no green bottles hanging on the wall.
```
17 changes: 17 additions & 0 deletions exercises/practice/bottle-song/.meta/Example.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
object BottleSong:
private val numbers = List("no", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten")

private def suffix(bottles: Int) = if bottles == 1 then "" else "s"

private def hanging(bottles: Int) =
s"${numbers(bottles)} green bottle${suffix(bottles)} hanging on the wall"

private def firstLine(bottles: Int) = hanging(bottles) + ",\n"

private def lastLine(bottles: Int) = "There'll be " + hanging(bottles).toLowerCase + ".\n"

private def verse(bottles: Int) = firstLine(bottles).repeat(2) +
"And if one green bottle should accidentally fall,\n" + lastLine(bottles - 1)

def recite(startBottles: Int, takeDown: Int): String =
startBottles until startBottles - takeDown by -1 map verse mkString "\n"
19 changes: 19 additions & 0 deletions exercises/practice/bottle-song/.meta/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"authors": [
"rabestro"
],
"files": {
"solution": [
"src/main/scala/BottleSong.scala"
],
"test": [
"src/test/scala/BottleSongTest.scala"
],
"example": [
".meta/Example.scala"
]
},
"blurb": "Produce the lyrics to the popular children's repetitive song: Ten Green Bottles.",
"source": "Wikipedia",
"source_url": "https://en.wikipedia.org/wiki/Ten_Green_Bottles"
}
31 changes: 31 additions & 0 deletions exercises/practice/bottle-song/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This is an auto-generated file.
#
# Regenerating this file via `configlet sync` will:
# - Recreate every `description` key/value pair
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
# - Preserve any other key/value pair
#
# As user-added comments (using the # character) will be removed when this file
# is regenerated, comments can be added via a `comment` key.

[d4ccf8fc-01dc-48c0-a201-4fbeb30f2d03]
description = "verse -> single verse -> first generic verse"

[0f0aded3-472a-4c64-b842-18d4f1f5f030]
description = "verse -> single verse -> last generic verse"

[f61f3c97-131f-459e-b40a-7428f3ed99d9]
description = "verse -> single verse -> verse with 2 bottles"

[05eadba9-5dbd-401e-a7e8-d17cc9baa8e0]
description = "verse -> single verse -> verse with 1 bottle"

[a4a28170-83d6-4dc1-bd8b-319b6abb6a80]
description = "lyrics -> multiple verses -> first two verses"

[3185d438-c5ac-4ce6-bcd3-02c9ff1ed8db]
description = "lyrics -> multiple verses -> last three verses"

[28c1584a-0e51-4b65-9ae2-fbc0bf4bbb28]
description = "lyrics -> multiple verses -> all verses"
3 changes: 3 additions & 0 deletions exercises/practice/bottle-song/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scalaVersion := "3.4.2"

libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.19" % Test
1 change: 1 addition & 0 deletions exercises/practice/bottle-song/project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.10.1
Empty file.
134 changes: 134 additions & 0 deletions exercises/practice/bottle-song/src/test/scala/BottleSongTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers

class BottleSongTest extends AnyFunSuite with Matchers {

test("first generic verse") {
BottleSong.recite(10, 1) shouldBe
"""Ten green bottles hanging on the wall,
|Ten green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be nine green bottles hanging on the wall.
|""".stripMargin.trim + "\n"
}

test("last generic verse") {
pending
BottleSong.recite(3, 1) shouldBe
"""Three green bottles hanging on the wall,
|Three green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be two green bottles hanging on the wall.
|""".stripMargin.trim + "\n"
}

test("verse with two bottles") {
pending
BottleSong.recite(2, 1) shouldBe
"""Two green bottles hanging on the wall,
|Two green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be one green bottle hanging on the wall.
|""".stripMargin.trim + "\n"
}

test("verse with one bottle") {
pending
BottleSong.recite(1, 1) shouldBe
"""One green bottle hanging on the wall,
|One green bottle hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be no green bottles hanging on the wall.
|""".stripMargin.trim + "\n"
}

test("first two verses") {
pending
BottleSong.recite(10, 2) shouldBe
"""Ten green bottles hanging on the wall,
|Ten green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be nine green bottles hanging on the wall.
|
|Nine green bottles hanging on the wall,
|Nine green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be eight green bottles hanging on the wall.
|""".stripMargin.trim + "\n"
}

test("last three verses") {
pending
BottleSong.recite(3, 3) shouldBe
"""Three green bottles hanging on the wall,
|Three green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be two green bottles hanging on the wall.
|
|Two green bottles hanging on the wall,
|Two green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be one green bottle hanging on the wall.
|
|One green bottle hanging on the wall,
|One green bottle hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be no green bottles hanging on the wall.
|""".stripMargin.trim + "\n"
}

test("all verses") {
pending
BottleSong.recite(10, 10) shouldBe
"""Ten green bottles hanging on the wall,
|Ten green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be nine green bottles hanging on the wall.
|
|Nine green bottles hanging on the wall,
|Nine green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be eight green bottles hanging on the wall.
|
|Eight green bottles hanging on the wall,
|Eight green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be seven green bottles hanging on the wall.
|
|Seven green bottles hanging on the wall,
|Seven green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be six green bottles hanging on the wall.
|
|Six green bottles hanging on the wall,
|Six green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be five green bottles hanging on the wall.
|
|Five green bottles hanging on the wall,
|Five green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be four green bottles hanging on the wall.
|
|Four green bottles hanging on the wall,
|Four green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be three green bottles hanging on the wall.
|
|Three green bottles hanging on the wall,
|Three green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be two green bottles hanging on the wall.
|
|Two green bottles hanging on the wall,
|Two green bottles hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be one green bottle hanging on the wall.
|
|One green bottle hanging on the wall,
|One green bottle hanging on the wall,
|And if one green bottle should accidentally fall,
|There'll be no green bottles hanging on the wall.
|""".stripMargin.trim + "\n"
}
}
14 changes: 4 additions & 10 deletions exercises/practice/change/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# Instructions

Correctly determine the fewest number of coins to be given to a customer such that the sum of the coins' value would equal the correct amount of change.
Determine the fewest number of coins to give a customer so that the sum of their values equals the correct amount of change.

## For example
## Examples

- An input of 15 with [1, 5, 10, 25, 100] should return one nickel (5) and one dime (10) or [5, 10]
- An input of 40 with [1, 5, 10, 25, 100] should return one nickel (5) and one dime (10) and one quarter (25) or [5, 10, 25]

## Edge cases

- Does your algorithm work for any given set of coins?
- Can you ask for negative change?
- Can you ask for a change value smaller than the smallest coin value?
- An amount of 15 with available coin values [1, 5, 10, 25, 100] should return one coin of value 5 and one coin of value 10, or [5, 10].
- An amount of 40 with available coin values [1, 5, 10, 25, 100] should return one coin of value 5, one coin of value 10, and one coin of value 25, or [5, 10, 25].
28 changes: 1 addition & 27 deletions exercises/practice/collatz-conjecture/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
# Instructions

The Collatz Conjecture or 3x+1 problem can be summarized as follows:

Take any positive integer n.
If n is even, divide n by 2 to get n / 2.
If n is odd, multiply n by 3 and add 1 to get 3n + 1.
Repeat the process indefinitely.
The conjecture states that no matter which number you start with, you will always reach 1 eventually.

Given a number n, return the number of steps required to reach 1.

## Examples

Starting with n = 12, the steps would be as follows:

0. 12
1. 6
2. 3
3. 10
4. 5
5. 16
6. 8
7. 4
8. 2
9. 1

Resulting in 9 steps.
So for input n = 12, the return value would be 9.
Given a positive integer, return the number of steps it takes to reach 1 according to the rules of the Collatz Conjecture.
Loading