Skip to content

Commit

Permalink
Syncing tests, filepaths, methdata and docs with problem-specificatio…
Browse files Browse the repository at this point in the history
…n repocitory
  • Loading branch information
jagdish-15 committed Nov 17, 2024
1 parent 85652b5 commit 0f57713
Show file tree
Hide file tree
Showing 17 changed files with 204 additions and 40 deletions.
18 changes: 15 additions & 3 deletions exercises/practice/bob/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# This is an auto-generated file. Regular comments will be removed when this
# file is regenerated. Regenerating will not touch any manually added keys,
# so comments can be added in a "comment" key.
# 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.

[e162fead-606f-437a-a166-d051915cea8e]
description = "stating something"
Expand Down Expand Up @@ -64,6 +71,7 @@ description = "alternate silence"

[66953780-165b-4e7e-8ce3-4bcb80b6385a]
description = "multiple line question"
include = false

[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
description = "starting with whitespace"
Expand All @@ -76,3 +84,7 @@ description = "other whitespace"

[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
description = "non-question ending with whitespace"

[2c7278ac-f955-4eb4-bf8f-e33eb4116a15]
description = "multiple line question"
reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a"
3 changes: 3 additions & 0 deletions exercises/practice/dot-dsl/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"editor": [
"src/main/java/Node.java",
"src/main/java/Edge.java"
],
"invalidator": [
"build.gradle"
]
},
"blurb": "Write a Domain Specific Language similar to the Graphviz dot language.",
Expand Down
18 changes: 18 additions & 0 deletions exercises/practice/forth/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ description = "addition -> errors if there is nothing on the stack"
[06efb9a4-817a-435e-b509-06166993c1b8]
description = "addition -> errors if there is only one value on the stack"

[1e07a098-c5fa-4c66-97b2-3c81205dbc2f]
description = "addition -> more than two values on the stack"

[09687c99-7bbc-44af-8526-e402f997ccbf]
description = "subtraction -> can subtract two numbers"

Expand All @@ -33,6 +36,9 @@ description = "subtraction -> errors if there is nothing on the stack"
[b3cee1b2-9159-418a-b00d-a1bb3765c23b]
description = "subtraction -> errors if there is only one value on the stack"

[2c8cc5ed-da97-4cb1-8b98-fa7b526644f4]
description = "subtraction -> more than two values on the stack"

[5df0ceb5-922e-401f-974d-8287427dbf21]
description = "multiplication -> can multiply two numbers"

Expand All @@ -42,6 +48,9 @@ description = "multiplication -> errors if there is nothing on the stack"
[8ba4b432-9f94-41e0-8fae-3b3712bd51b3]
description = "multiplication -> errors if there is only one value on the stack"

[5cd085b5-deb1-43cc-9c17-6b1c38bc9970]
description = "multiplication -> more than two values on the stack"

[e74c2204-b057-4cff-9aa9-31c7c97a93f5]
description = "division -> can divide two numbers"

Expand All @@ -57,12 +66,21 @@ description = "division -> errors if there is nothing on the stack"
[d5547f43-c2ff-4d5c-9cb0-2a4f6684c20d]
description = "division -> errors if there is only one value on the stack"

[f224f3e0-b6b6-4864-81de-9769ecefa03f]
description = "division -> more than two values on the stack"

[ee28d729-6692-4a30-b9be-0d830c52a68c]
description = "combined arithmetic -> addition and subtraction"

[40b197da-fa4b-4aca-a50b-f000d19422c1]
description = "combined arithmetic -> multiplication and division"

[f749b540-53aa-458e-87ec-a70797eddbcb]
description = "combined arithmetic -> multiplication and addition"

[c8e5a4c2-f9bf-4805-9a35-3c3314e4989a]
description = "combined arithmetic -> addition and multiplication"

[c5758235-6eef-4bf6-ab62-c878e50b9957]
description = "dup -> copies a value on the stack"

Expand Down
10 changes: 5 additions & 5 deletions exercises/practice/hamming/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Instructions

Calculate the Hamming Distance between two DNA strands.
Calculate the Hamming distance between two DNA strands.

Your body is made up of cells that contain DNA.
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
Expand All @@ -9,18 +9,18 @@ In fact, the average human body experiences about 10 quadrillion cell divisions
When cells divide, their DNA replicates too.
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred.
This is known as the "Hamming Distance".
This is known as the "Hamming distance".

We read DNA using the letters C,A,G and T.
We read DNA using the letters C, A, G and T.
Two strands might look like this:

GAGCCTACTAACGGGAT
CATCGTAATGACGGCCT
^ ^ ^ ^ ^ ^^

They have 7 differences, and therefore the Hamming Distance is 7.
They have 7 differences, and therefore the Hamming distance is 7.

The Hamming Distance is useful for lots of things in science, not just biology, so it's a nice phrase to be familiar with :)
The Hamming distance is useful for lots of things in science, not just biology, so it's a nice phrase to be familiar with :)

## Implementation notes

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/hamming/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"build.gradle"
]
},
"blurb": "Calculate the Hamming difference between two DNA strands.",
"blurb": "Calculate the Hamming distance between two DNA strands.",
"source": "The Calculating Point Mutations problem at Rosalind",
"source_url": "https://rosalind.info/problems/hamm/"
}
3 changes: 2 additions & 1 deletion exercises/practice/luhn/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ The first step of the Luhn algorithm is to double every second digit, starting f
We will be doubling

```text
4_3_ 3_9_ 0_4_ 6_6_
4539 3195 0343 6467
↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ (double these)
```

If doubling the number results in a number greater than 9 then subtract 9 from the product.
Expand Down
24 changes: 17 additions & 7 deletions exercises/practice/palindrome-products/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# This is an auto-generated file. Regular comments will be removed when this
# file is regenerated. Regenerating will not touch any manually added keys,
# so comments can be added in a "comment" key.
# 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.

[5cff78fe-cf02-459d-85c2-ce584679f887]
description = "finds the smallest palindrome from single digit factors"
description = "find the smallest palindrome from single digit factors"

[0853f82c-5fc4-44ae-be38-fadb2cced92d]
description = "finds the largest palindrome from single digit factors"
description = "find the largest palindrome from single digit factors"

[66c3b496-bdec-4103-9129-3fcb5a9063e1]
description = "find the smallest palindrome from double digit factors"
Expand All @@ -15,13 +22,13 @@ description = "find the smallest palindrome from double digit factors"
description = "find the largest palindrome from double digit factors"

[cecb5a35-46d1-4666-9719-fa2c3af7499d]
description = "find smallest palindrome from triple digit factors"
description = "find the smallest palindrome from triple digit factors"

[edab43e1-c35f-4ea3-8c55-2f31dddd92e5]
description = "find the largest palindrome from triple digit factors"

[4f802b5a-9d74-4026-a70f-b53ff9234e4e]
description = "find smallest palindrome from four digit factors"
description = "find the smallest palindrome from four digit factors"

[787525e0-a5f9-40f3-8cb2-23b52cf5d0be]
description = "find the largest palindrome from four digit factors"
Expand All @@ -37,3 +44,6 @@ description = "error result for smallest if min is more than max"

[eeeb5bff-3f47-4b1e-892f-05829277bd74]
description = "error result for largest if min is more than max"

[16481711-26c4-42e0-9180-e2e4e8b29c23]
description = "smallest product does not use the smallest factor"
52 changes: 48 additions & 4 deletions exercises/practice/poker/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# This is an auto-generated file. Regular comments will be removed when this
# file is regenerated. Regenerating will not touch any manually added keys,
# so comments can be added in a "comment" key.
# 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.

[161f485e-39c2-4012-84cf-bec0c755b66c]
description = "single hand always wins"
Expand All @@ -14,12 +21,18 @@ description = "a tie has multiple winners"
[61ed83a9-cfaa-40a5-942a-51f52f0a8725]
description = "multiple hands with the same high cards, tie compares next highest ranked, down to last card"

[da01becd-f5b0-4342-b7f3-1318191d0580]
description = "winning high card hand also has the lowest card"

[f7175a89-34ff-44de-b3d7-f6fd97d1fca4]
description = "one pair beats high card"

[e114fd41-a301-4111-a9e7-5a7f72a76561]
description = "highest pair wins"

[b3acd3a7-f9fa-4647-85ab-e0a9e07d1365]
description = "both hands have the same pair, high card wins"

[935bb4dc-a622-4400-97fa-86e7d06b1f76]
description = "two pairs beats one pair"

Expand All @@ -32,6 +45,12 @@ description = "both hands have two pairs, with the same highest ranked pair, tie
[15a7a315-0577-47a3-9981-d6cf8e6f387b]
description = "both hands have two identically ranked pairs, tie goes to remaining card (kicker)"

[f761e21b-2560-4774-a02a-b3e9366a51ce]
description = "both hands have two pairs that add to the same value, win goes to highest pair"

[fc6277ac-94ac-4078-8d39-9d441bc7a79e]
description = "two pairs first ranked by largest pair"

[21e9f1e6-2d72-49a1-a930-228e5e0195dc]
description = "three of a kind beats two pair"

Expand All @@ -40,6 +59,11 @@ description = "both hands have three of a kind, tie goes to highest ranked tripl

[eb856cc2-481c-4b0d-9835-4d75d07a5d9d]
description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards"
include = false

[26a4a7d4-34a2-4f18-90b4-4a8dd35d2bb1]
description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards"
reimplements = "eb856cc2-481c-4b0d-9835-4d75d07a5d9d"

[a858c5d9-2f28-48e7-9980-b7fa04060a60]
description = "a straight beats three of a kind"
Expand All @@ -50,6 +74,9 @@ description = "aces can end a straight (10 J Q K A)"
[76856b0d-35cd-49ce-a492-fe5db53abc02]
description = "aces can start a straight (A 2 3 4 5)"

[e214b7df-dcba-45d3-a2e5-342d8c46c286]
description = "aces cannot be in the middle of a straight (Q K A 2 3)"

[6980c612-bbff-4914-b17a-b044e4e69ea1]
description = "both hands with a straight, tie goes to highest ranked card"

Expand All @@ -61,6 +88,11 @@ description = "flush beats a straight"

[4d90261d-251c-49bd-a468-896bf10133de]
description = "both hands have a flush, tie goes to high card, down to the last one if necessary"
include = false

[e04137c5-c19a-4dfc-97a1-9dfe9baaa2ff]
description = "both hands have a flush, tie goes to high card, down to the last one if necessary"
reimplements = "4d90261d-251c-49bd-a468-896bf10133de"

[3a19361d-8974-455c-82e5-f7152f5dba7c]
description = "full house beats a flush"
Expand All @@ -83,5 +115,17 @@ description = "with multiple decks, both hands with identical four of a kind, ti
[923bd910-dc7b-4f7d-a330-8b42ec10a3ac]
description = "straight flush beats four of a kind"

[d9629e22-c943-460b-a951-2134d1b43346]
description = "aces can end a straight flush (10 J Q K A)"

[05d5ede9-64a5-4678-b8ae-cf4c595dc824]
description = "aces can start a straight flush (A 2 3 4 5)"

[ad655466-6d04-49e8-a50c-0043c3ac18ff]
description = "aces cannot be in the middle of a straight flush (Q K A 2 3)"

[d0927f70-5aec-43db-aed8-1cbd1b6ee9ad]
description = "both hands have straight flush, tie goes to highest-ranked card"
description = "both hands have a straight flush, tie goes to highest-ranked card"

[be620e09-0397-497b-ac37-d1d7a4464cfc]
description = "even though an ace is usually high, a 5-high straight flush is the lowest-scoring straight flush"
2 changes: 1 addition & 1 deletion exercises/practice/pov/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
},
"blurb": "Reparent a graph on a selected node.",
"source": "Adaptation of exercise from 4clojure",
"source_url": "https://www.4clojure.com/"
"source_url": "https://github.com/oxalorg/4ever-clojure"
}
6 changes: 3 additions & 3 deletions exercises/practice/rna-transcription/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Instructions

Your task is determine the RNA complement of a given DNA sequence.
Your task is to determine the RNA complement of a given DNA sequence.

Both DNA and RNA strands are a sequence of nucleotides.

The four nucleotides found in DNA are adenine (**A**), cytosine (**C**), guanine (**G**) and thymine (**T**).
The four nucleotides found in DNA are adenine (**A**), cytosine (**C**), guanine (**G**), and thymine (**T**).

The four nucleotides found in RNA are adenine (**A**), cytosine (**C**), guanine (**G**) and uracil (**U**).
The four nucleotides found in RNA are adenine (**A**), cytosine (**C**), guanine (**G**), and uracil (**U**).

Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement:

Expand Down
35 changes: 35 additions & 0 deletions exercises/practice/sgf-parsing/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,40 @@ description = "two child trees"
[724eeda6-00db-41b1-8aa9-4d5238ca0130]
description = "multiple property values"

[28092c06-275f-4b9f-a6be-95663e69d4db]
description = "within property values, whitespace characters such as tab are converted to spaces"

[deaecb9d-b6df-4658-aa92-dcd70f4d472a]
description = "within property values, newlines remain as newlines"

[8e4c970e-42d7-440e-bfef-5d7a296868ef]
description = "escaped closing bracket within property value becomes just a closing bracket"

[cf371fa8-ba4a-45ec-82fb-38668edcb15f]
description = "escaped backslash in property value becomes just a backslash"

[dc13ca67-fac0-4b65-b3fe-c584d6a2c523]
description = "opening bracket within property value doesn't need to be escaped"

[a780b97e-8dbb-474e-8f7e-4031902190e8]
description = "semicolon in property value doesn't need to be escaped"

[0b57a79e-8d89-49e5-82b6-2eaaa6b88ed7]
description = "parentheses in property value don't need to be escaped"

[c72a33af-9e04-4cc5-9890-1b92262813ac]
description = "escaped tab in property value is converted to space"

[3a1023d2-7484-4498-8d73-3666bb386e81]
description = "escaped newline in property value is converted to nothing at all"

[25abf1a4-5205-46f1-8c72-53273b94d009]
description = "escaped t and n in property value are just letters, not whitespace"

[08e4b8ba-bb07-4431-a3d9-b1f4cdea6dab]
description = "mixing various kinds of whitespace and escaped characters in property value"
reimplements = "11c36323-93fc-495d-bb23-c88ee5844b8c"

[11c36323-93fc-495d-bb23-c88ee5844b8c]
description = "escaped property"
include = false
17 changes: 11 additions & 6 deletions exercises/practice/square-root/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Instructions

Given a natural radicand, return its square root.
Your task is to calculate the square root of a given number.

Note that the term "radicand" refers to the number for which the root is to be determined.
That is, it is the number under the root symbol.
- Try to avoid using the pre-existing math libraries of your language.
- As input you'll be given a positive whole number, i.e. 1, 2, 3, 4…
- You are only required to handle cases where the result is a positive whole number.

Check out the Wikipedia pages on [square root][square-root] and [methods of computing square roots][computing-square-roots].
Some potential approaches:

Recall also that natural numbers are positive real whole numbers (i.e. 1, 2, 3 and up).
- Linear or binary search for a number that gives the input number when squared.
- Successive approximation using Newton's or Heron's method.
- Calculating one digit at a time or one bit at a time.

[square-root]: https://en.wikipedia.org/wiki/Square_root
You can check out the Wikipedia pages on [integer square root][integer-square-root] and [methods of computing square roots][computing-square-roots] to help with choosing a method of calculation.

[integer-square-root]: https://en.wikipedia.org/wiki/Integer_square_root
[computing-square-roots]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots
10 changes: 10 additions & 0 deletions exercises/practice/square-root/.docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Introduction

We are launching a deep space exploration rocket and we need a way to make sure the navigation system stays on target.

As the first step in our calculation, we take a target number and find its square root (that is, the number that when multiplied by itself equals the target number).

The journey will be very long.
To make the batteries last as long as possible, we had to make our rocket's onboard computer very power efficient.
Unfortunately that means that we can't rely on fancy math libraries and functions, as they use more power.
Instead we want to implement our own square root calculation.
Loading

0 comments on commit 0f57713

Please sign in to comment.