Skip to content

Commit 13ed379

Browse files
committed
Sync metadata, tests, and docs
1 parent fe69920 commit 13ed379

File tree

11 files changed

+110
-42
lines changed

11 files changed

+110
-42
lines changed
+8-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
class Bob
2-
hey: (message) -> switch
3-
when message.trim() == "" then "Fine. Be that way!"
4-
when message.match(/[a-zA-Z]/) and message == message.toUpperCase() and message[message.length - 1] == "?" then "Calm down, I know what I'm doing!"
5-
when message.match(/[a-zA-Z]/) and message == message.toUpperCase() then "Whoa, chill out!"
6-
when message[message.length - 1] == "?" then "Sure."
7-
else "Whatever."
2+
hey: (message) ->
3+
message = message.trim()
4+
switch
5+
when message == "" then "Fine. Be that way!"
6+
when message.match(/[a-zA-Z]/) and message == message.toUpperCase() and message[message.length - 1] == "?" then "Calm down, I know what I'm doing!"
7+
when message.match(/[a-zA-Z]/) and message == message.toUpperCase() then "Whoa, chill out!"
8+
when message[message.length - 1] == "?" then "Sure."
9+
else "Whatever."
810
module.exports = Bob

exercises/practice/bob/.meta/tests.toml

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ description = "alternate silence"
7171

7272
[66953780-165b-4e7e-8ce3-4bcb80b6385a]
7373
description = "multiple line question"
74+
include = false
7475

7576
[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
7677
description = "starting with whitespace"
@@ -83,3 +84,7 @@ description = "other whitespace"
8384

8485
[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
8586
description = "non-question ending with whitespace"
87+
88+
[2c7278ac-f955-4eb4-bf8f-e33eb4116a15]
89+
description = "multiple line question"
90+
reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a"
+54-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Bob = require './bob'
2+
23
describe 'Bob', ->
34
bob = new Bob()
45
it 'stating something', ->
@@ -9,50 +10,94 @@ describe 'Bob', ->
910
result = bob.hey 'WATCH OUT!'
1011
expect(result).toEqual 'Whoa, chill out!'
1112

13+
xit 'shouting gibberish', ->
14+
result = bob.hey 'FCECDFCAAB'
15+
expect(result).toEqual 'Whoa, chill out!'
16+
1217
xit 'asking a question', ->
1318
result = bob.hey 'Does this cryogenic chamber make me look fat?'
1419
expect(result).toEqual 'Sure.'
1520

21+
xit 'asking a numeric question', ->
22+
result = bob.hey 'You are, what, like 15?'
23+
expect(result).toEqual 'Sure.'
24+
25+
xit 'asking gibberish', ->
26+
result = bob.hey 'fffbbcbeab?'
27+
expect(result).toEqual 'Sure.'
28+
1629
xit 'talking forcefully', ->
17-
result = bob.hey "Let's go make out behind the gym!"
30+
result = bob.hey 'Hi there!'
1831
expect(result).toEqual 'Whatever.'
1932

2033
xit 'using acronyms in regular speech', ->
21-
result = bob.hey "It's OK if you don't want to go to the DMV."
34+
result = bob.hey "It's OK if you don't want to go work for NASA."
2235
expect(result).toEqual 'Whatever.'
2336

24-
xit 'forceful questions', ->
37+
xit 'forceful question', ->
2538
result = bob.hey "WHAT'S GOING ON?"
2639
expect(result).toEqual "Calm down, I know what I'm doing!"
2740

2841
xit 'shouting numbers', ->
2942
result = bob.hey '1, 2, 3 GO!'
3043
expect(result).toEqual 'Whoa, chill out!'
3144

32-
xit 'only number', ->
45+
xit 'no letters', ->
3346
result = bob.hey '1, 2, 3'
3447
expect(result).toEqual 'Whatever.'
3548

49+
xit 'question with no letters', ->
50+
result = bob.hey '4?'
51+
expect(result).toEqual 'Sure.'
52+
3653
xit 'shouting with special characters', ->
37-
result = bob.hey 'ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!'
54+
result = bob.hey 'ZOMG THE %^*@ #$(*^ ZOMBIES ARE COMING!!11!!1!'
3855
expect(result).toEqual 'Whoa, chill out!'
3956

4057
xit 'shouting with no exclamation mark', ->
41-
result = bob.hey 'I HATE YOU'
58+
result = bob.hey 'I HATE THE DENTIST'
4259
expect(result).toEqual 'Whoa, chill out!'
4360

4461
xit 'statement containing question mark', ->
45-
result = bob.hey 'Ending with a ? means a question.'
62+
result = bob.hey 'Ending with ? means a question.'
4663
expect(result).toEqual 'Whatever.'
4764

65+
xit 'non-letters with question', ->
66+
result = bob.hey ':) ?'
67+
expect(result).toEqual 'Sure.'
68+
4869
xit 'prattling on', ->
49-
result = bob.hey 'Wait! Hang on. Are you going to be OK?'
70+
result = bob.hey 'Wait! Hang on. Are you going to be OK?'
5071
expect(result).toEqual 'Sure.'
5172

5273
xit 'silence', ->
5374
result = bob.hey ''
5475
expect(result).toEqual 'Fine. Be that way!'
5576

5677
xit 'prolonged silence', ->
57-
result = bob.hey ' '
78+
result = bob.hey ' '
5879
expect(result).toEqual 'Fine. Be that way!'
80+
81+
xit 'alternate silence', ->
82+
result = bob.hey '\t\t\t\t\t\t\t\t\t\t'
83+
expect(result).toEqual 'Fine. Be that way!'
84+
85+
xit 'multiple line question', ->
86+
result = bob.hey "\nDoes this cryogenic chamber make\n me look fat?"
87+
expect(result).toEqual 'Sure.'
88+
89+
xit 'starting with whitespace', ->
90+
result = bob.hey ' hmmmmmmm...'
91+
expect(result).toEqual 'Whatever.'
92+
93+
xit 'ending with whitespace', ->
94+
result = bob.hey 'Okay if like my spacebar quite a bit? '
95+
expect(result).toEqual 'Sure.'
96+
97+
xit 'other whitespace', ->
98+
result = bob.hey "\n\r \t"
99+
expect(result).toEqual 'Fine. Be that way!'
100+
101+
xit 'non-question ending with whitespace', ->
102+
result = bob.hey 'This is a statement ending with whitespace '
103+
expect(result).toEqual 'Whatever.'

exercises/practice/hamming/.docs/instructions.md

-11
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
Calculate the Hamming distance between two DNA strands.
44

5-
Your body is made up of cells that contain DNA.
6-
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
7-
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
8-
9-
When cells divide, their DNA replicates too.
10-
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
11-
If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred.
12-
This is known as the "Hamming distance".
13-
145
We read DNA using the letters C, A, G and T.
156
Two strands might look like this:
167

@@ -20,8 +11,6 @@ Two strands might look like this:
2011

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

23-
The Hamming distance is useful for lots of things in science, not just biology, so it's a nice phrase to be familiar with :)
24-
2514
## Implementation notes
2615

2716
The Hamming distance is only defined for sequences of equal length, so an attempt to calculate it between sequences of different lengths should not work.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Introduction
2+
3+
Your body is made up of cells that contain DNA.
4+
Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells.
5+
In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
6+
7+
When cells divide, their DNA replicates too.
8+
Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information.
9+
If we compare two strands of DNA and count the differences between them, we can see how many mistakes occurred.
10+
This is known as the "Hamming distance".
11+
12+
The Hamming distance is useful in many areas of science, not just biology, so it's a nice phrase to be familiar with :)

exercises/practice/hamming/.meta/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
".meta/example.coffee"
1414
]
1515
},
16-
"blurb": "Calculate the Hamming difference between two DNA strands.",
16+
"blurb": "Calculate the Hamming distance between two DNA strands.",
1717
"source": "The Calculating Point Mutations problem at Rosalind",
1818
"source_url": "https://rosalind.info/problems/hamm/"
1919
}

exercises/practice/protein-translation/.docs/instructions.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
Translate RNA sequences into proteins.
44

5-
RNA can be broken into three nucleotide sequences called codons, and then translated to a polypeptide like so:
5+
RNA can be broken into three-nucleotide sequences called codons, and then translated to a protein like so:
66

77
RNA: `"AUGUUUUCU"` => translates to
88

99
Codons: `"AUG", "UUU", "UCU"`
10-
=> which become a polypeptide with the following sequence =>
10+
=> which become a protein with the following sequence =>
1111

1212
Protein: `"Methionine", "Phenylalanine", "Serine"`
1313

@@ -27,9 +27,9 @@ Protein: `"Methionine", "Phenylalanine", "Serine"`
2727

2828
Note the stop codon `"UAA"` terminates the translation and the final methionine is not translated into the protein sequence.
2929

30-
Below are the codons and resulting Amino Acids needed for the exercise.
30+
Below are the codons and resulting amino acids needed for the exercise.
3131

32-
| Codon | Protein |
32+
| Codon | Amino Acid |
3333
| :----------------- | :------------ |
3434
| AUG | Methionine |
3535
| UUU, UUC | Phenylalanine |

exercises/practice/rna-transcription/.docs/instructions.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Instructions
22

3-
Your task is determine the RNA complement of a given DNA sequence.
3+
Your task is to determine the RNA complement of a given DNA sequence.
44

55
Both DNA and RNA strands are a sequence of nucleotides.
66

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

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

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

Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# Instructions
22

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

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

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

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

12-
[square-root]: https://en.wikipedia.org/wiki/Square_root
15+
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.
16+
17+
[integer-square-root]: https://en.wikipedia.org/wiki/Integer_square_root
1318
[computing-square-roots]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Introduction
2+
3+
We are launching a deep space exploration rocket and we need a way to make sure the navigation system stays on target.
4+
5+
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).
6+
7+
The journey will be very long.
8+
To make the batteries last as long as possible, we had to make our rocket's onboard computer very power efficient.
9+
Unfortunately that means that we can't rely on fancy math libraries and functions, as they use more power.
10+
Instead we want to implement our own square root calculation.

exercises/practice/sublist/.docs/instructions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Given any two lists `A` and `B`, determine if:
88
- None of the above is true, thus lists `A` and `B` are unequal
99

1010
Specifically, list `A` is equal to list `B` if both lists have the same values in the same order.
11-
List `A` is a superlist of `B` if `A` contains a sub-sequence of values equal to `B`.
12-
List `A` is a sublist of `B` if `B` contains a sub-sequence of values equal to `A`.
11+
List `A` is a superlist of `B` if `A` contains a contiguous sub-sequence of values equal to `B`.
12+
List `A` is a sublist of `B` if `B` contains a contiguous sub-sequence of values equal to `A`.
1313

1414
Examples:
1515

0 commit comments

Comments
 (0)