Skip to content

Commit 00e2c3c

Browse files
committed
Sync recent problem spec changes (exercism#355)
* sync docs and metadata * sync protein-translation tests * sync zebra-puzzle and update example to match instructions
1 parent 81e30a0 commit 00e2c3c

File tree

5 files changed

+44
-35
lines changed

5 files changed

+44
-35
lines changed

exercises/practice/protein-translation/.meta/tests.toml

+4
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,15 @@ description = "Translation stops if STOP codon in middle of three-codon sequence
8787
[2c2a2a60-401f-4a80-b977-e0715b23b93d]
8888
description = "Translation stops if STOP codon in middle of six-codon sequence"
8989

90+
[f6f92714-769f-4187-9524-e353e8a41a80]
91+
description = "Sequence of two non-STOP codons does not translate to a STOP codon"
92+
9093
[1e75ea2a-f907-4994-ae5c-118632a1cb0f]
9194
description = "Non-existing codon can't translate"
9295

9396
[9eac93f3-627a-4c90-8653-6d0a0595bc6f]
9497
description = "Unknown amino acids, not part of a codon, can't translate"
98+
reimplements = "1e75ea2a-f907-4994-ae5c-118632a1cb0f"
9599

96100
[9d73899f-e68e-4291-b1e2-7bf87c00f024]
97101
description = "Incomplete RNA sequence can't translate"

exercises/practice/protein-translation/protein-translation.test

+5
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,10 @@ test proteins-30 "Incomplete RNA sequence can translate if valid until a STOP co
155155
proteins UUCUUCUAAUGGU
156156
} -returnCodes ok -result {Phenylalanine Phenylalanine}
157157

158+
skip proteins-31
159+
test proteins-31 "Sequence of two non-STOP codons does not translate to a STOP codon" -body {
160+
proteins AUGAUG
161+
} -returnCodes ok -result {Methionine Methionine}
162+
158163

159164
cleanupTests

exercises/practice/zebra-puzzle/.docs/instructions.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ The following 15 statements are all known to be true:
1212
1. There are five houses.
1313
2. The Englishman lives in the red house.
1414
3. The Spaniard owns the dog.
15-
4. Coffee is drunk in the green house.
15+
4. The person in the green house drinks coffee.
1616
5. The Ukrainian drinks tea.
1717
6. The green house is immediately to the right of the ivory house.
18-
7. The Old Gold smoker owns snails.
19-
8. Kools are smoked in the yellow house.
20-
9. Milk is drunk in the middle house.
18+
7. The snail owner likes to go dancing.
19+
8. The person in the yellow house is a painter.
20+
9. The person in the middle house drinks milk.
2121
10. The Norwegian lives in the first house.
22-
11. The man who smokes Chesterfields lives in the house next to the man with the fox.
23-
12. Kools are smoked in the house next to the house where the horse is kept.
24-
13. The Lucky Strike smoker drinks orange juice.
25-
14. The Japanese smokes Parliaments.
22+
11. The person who enjoys reading lives in the house next to the person with the fox.
23+
12. The painter's house is next to the house with the horse.
24+
13. The person who plays football drinks orange juice.
25+
14. The Japanese person plays chess.
2626
15. The Norwegian lives next to the blue house.
2727

28-
Additionally, each of the five houses is painted a different color, and their inhabitants are of different national extractions, own different pets, drink different beverages and smoke different brands of cigarettes.
28+
Additionally, each of the five houses is painted a different color, and their inhabitants are of different national extractions, own different pets, drink different beverages and engage in different hobbies.
2929

3030
~~~~exercism/note
3131
There are 24 billion (5!⁵ = 24,883,200,000) possible solutions, so try ruling out as many solutions as possible.

exercises/practice/zebra-puzzle/.docs/introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Introduction
22

33
The Zebra Puzzle is a famous logic puzzle in which there are five houses, each painted a different color.
4-
The houses have different inhabitants, who have different nationalities, own different pets, drink different beverages and smoke different brands of cigarettes.
4+
The houses have different inhabitants, who have different nationalities, own different pets, drink different beverages and enjoy different hobbies.
55

66
To help you solve the puzzle, you're given 15 statements describing the solution.
77
However, only by combining the information in _all_ statements will you be able to find the solution to the puzzle.

exercises/practice/zebra-puzzle/.meta/example.tcl

+25-25
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ proc ::tcl::mathfunc::nextTo {first second} {
1818
# algorithm taken from Kotlin example solution
1919

2020
# The clues, and the method that implements them:
21-
# 1. There are five houses.
22-
# 2. The Englishman lives in the red house. (SolveForNationality)
23-
# 3. The Spaniard owns the dog. (SolveForPets)
24-
# 4. Coffee is drunk in the green house. (SolveForBeverages)
25-
# 5. The Ukrainian drinks tea. (SolveForBeverages)
26-
# 6. The green house is immediately to the right of the ivory house. (SolveForColour)
27-
# 7. The Old Gold smoker owns snails. (SolveForPets)
28-
# 8. Kools are smoked in the yellow house. (SolveForSmokes)
29-
# 9. Milk is drunk in the middle house. (SolveForBeverages)
30-
# 10.The Norwegian lives in the first house. (SolveForNationality)
31-
# 11.The man who smokes Chesterfields lives in the house next to the man with the fox. (SolveForPets)
32-
# 12.Kools are smoked in the house next to the house where the horse is kept.
33-
# 13.The Lucky Strike smoker drinks orange juice. (SolveForSmokes)
34-
# 14.The Japanese smokes Parliaments. (SolveForSmokes)
35-
# 15.The Norwegian lives next to the blue house. (SolveForNationality)
21+
# 1. There are five houses.
22+
# 2. The Englishman lives in the red house. (SolveForNationality)
23+
# 3. The Spaniard owns the dog. (SolveForPets)
24+
# 4. The person in the green house drinks coffee. (SolveForBeverages)
25+
# 5. The Ukrainian drinks tea. (SolveForBeverages)
26+
# 6. The green house is immediately to the right of the ivory house. (SolveForColour)
27+
# 7. The snail owner likes to go dancing. (SolveForPets)
28+
# 8. The person in the yellow house is a painter. (SolveForHobbies)
29+
# 9. The person in the middle house drinks milk. (SolveForBeverages)
30+
# 10. The Norwegian lives in the first house. (SolveForNationality)
31+
# 11. The person who enjoys reading lives in the house next to the person with the fox. (SolveForPets)
32+
# 12. The painter's house is next to the house with the horse. (SolveForPets)
33+
# 13. The person who plays football drinks orange juice. (SolveForHobbies)
34+
# 14. The Japanese person plays chess. (SolveForHobbies)
35+
# 15. The Norwegian lives next to the blue house. (SolveForNationality)
3636

3737
############################################################
3838
oo::class create ZebraPuzzle {
@@ -43,7 +43,7 @@ oo::class create ZebraPuzzle {
4343
variable red green ivory yellow blue
4444
variable english spanish ukranian norwegian japanese
4545
variable dog snails fox horse zebra
46-
variable oldGold kools chesterfields luckyStrike parliaments
46+
variable dancing painting reading football chess
4747
variable coffee tea milk orangeJuice water
4848

4949
variable nationalities
@@ -112,19 +112,19 @@ oo::class create ZebraPuzzle {
112112
&& $milk == $MIDDLE
113113
} {
114114
foreach p [permutations] {
115-
if {[my SolveForSmokes $p]} then {return true}
115+
if {[my SolveForHobbies $p]} then {return true}
116116
}
117117
}
118118
return false
119119
}
120120

121-
method SolveForSmokes {permutation} {
122-
lassign $permutation oldGold kools chesterfields luckyStrike parliaments
121+
method SolveForHobbies {permutation} {
122+
lassign $permutation dancing painting reading football chess
123123
# clues 8, 13, 14
124124
if {
125-
$kools == $yellow
126-
&& $luckyStrike == $orangeJuice
127-
&& $japanese == $parliaments
125+
$painting == $yellow
126+
&& $football == $orangeJuice
127+
&& $japanese == $chess
128128
} {
129129
foreach p [permutations] {
130130
if {[my SolveForPets $p]} then {return true}
@@ -138,9 +138,9 @@ oo::class create ZebraPuzzle {
138138
# clues 3, 7, 11, 12
139139
if {
140140
$spanish == $dog
141-
&& $oldGold == $snails
142-
&& nextTo($chesterfields, $fox)
143-
&& nextTo($kools, $horse)
141+
&& $dancing == $snails
142+
&& nextTo($reading, $fox)
143+
&& nextTo($painting, $horse)
144144
} {
145145
set waterDrinker [dict get $nationalities $water]
146146
set zebraOwner [dict get $nationalities $zebra]

0 commit comments

Comments
 (0)