Skip to content

Commit 5e4dc23

Browse files
authored
Synced docs for Space-Age and Zebra-Puzzle. (#3727)
1 parent de75875 commit 5e4dc23

File tree

4 files changed

+47
-24
lines changed

4 files changed

+47
-24
lines changed
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
# Instructions
22

3-
Given an age in seconds, calculate how old someone would be on:
3+
Given an age in seconds, calculate how old someone would be on a planet in our Solar System.
44

5-
- Mercury: orbital period 0.2408467 Earth years
6-
- Venus: orbital period 0.61519726 Earth years
7-
- Earth: orbital period 1.0 Earth years, 365.25 Earth days, or 31557600 seconds
8-
- Mars: orbital period 1.8808158 Earth years
9-
- Jupiter: orbital period 11.862615 Earth years
10-
- Saturn: orbital period 29.447498 Earth years
11-
- Uranus: orbital period 84.016846 Earth years
12-
- Neptune: orbital period 164.79132 Earth years
5+
One Earth year equals 365.25 Earth days, or 31,557,600 seconds.
6+
If you were told someone was 1,000,000,000 seconds old, their age would be 31.69 Earth-years.
137

14-
So if you were told someone were 1,000,000,000 seconds old, you should
15-
be able to say that they're 31.69 Earth-years old.
8+
For the other planets, you have to account for their orbital period in Earth Years:
169

17-
If you're wondering why Pluto didn't make the cut, go watch [this YouTube video][pluto-video].
10+
| Planet | Orbital period in Earth Years |
11+
| ------- | ----------------------------- |
12+
| Mercury | 0.2408467 |
13+
| Venus | 0.61519726 |
14+
| Earth | 1.0 |
15+
| Mars | 1.8808158 |
16+
| Jupiter | 11.862615 |
17+
| Saturn | 29.447498 |
18+
| Uranus | 84.016846 |
19+
| Neptune | 164.79132 |
1820

19-
Note: The actual length of one complete orbit of the Earth around the sun is closer to 365.256 days (1 sidereal year).
21+
~~~~exercism/note
22+
The actual length of one complete orbit of the Earth around the sun is closer to 365.256 days (1 sidereal year).
2023
The Gregorian calendar has, on average, 365.2425 days.
2124
While not entirely accurate, 365.25 is the value used in this exercise.
2225
See [Year on Wikipedia][year] for more ways to measure a year.
2326
24-
[pluto-video]: https://www.youtube.com/watch?v=Z_2gbGXzFbs
2527
[year]: https://en.wikipedia.org/wiki/Year#Summary
28+
~~~~
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Introduction
2+
3+
The year is 2525 and you've just embarked on a journey to visit all planets in the Solar System (Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus and Neptune).
4+
The first stop is Mercury, where customs require you to fill out a form (bureaucracy is apparently _not_ Earth-specific).
5+
As you hand over the form to the customs officer, they scrutinize it and frown.
6+
"Do you _really_ expect me to believe you're just 50 years old?
7+
You must be closer to 200 years old!"
8+
9+
Amused, you wait for the customs officer to start laughing, but they appear to be dead serious.
10+
You realize that you've entered your age in _Earth years_, but the officer expected it in _Mercury years_!
11+
As Mercury's orbital period around the sun is significantly shorter than Earth, you're actually a lot older in Mercury years.
12+
After some quick calculations, you're able to provide your age in Mercury Years.
13+
The customs officer smiles, satisfied, and waves you through.
14+
You make a mental note to pre-calculate your planet-specific age _before_ future customs checks, to avoid such mix-ups.
15+
16+
~~~~exercism/note
17+
If you're wondering why Pluto didn't make the cut, go watch [this YouTube video][pluto-video].
18+
19+
[pluto-video]: https://www.youtube.com/watch?v=Z_2gbGXzFbs
20+
~~~~

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

Lines changed: 9 additions & 9 deletions
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

Lines changed: 1 addition & 1 deletion
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.

0 commit comments

Comments
 (0)